Category:Linux Config

From ElectroDragon Wiki
Revision as of 22:05, 31 January 2020 by Chao (talk | contribs) (→‎Swap)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Grub

  • sudo vi /etc/default/grub
  • GRUB_CMDLINE_LINUX="" -> GRUB_CMDLINE_LINUX="text"
  • sudo update-grub
  • sudo systemctl set-default multi-user.target, and you can revert it later by -> sudo systemctl set-default graphical.target

reference


Swap

Use swap file

touch /swap-file
mkswap /swap-file
swapon /swap-file
swapon -s

Write the file on boot

/swap-file swap                    swap    defaults        0 0

Common Install

  • Network
apt-get install curl privoxy curl
  • Disk
apt-get install gparted
  • input method
apt-get install fcitx fcitx-pinyin #remember to set according fcitx diagnose
  • Editor
sudo apt-get install snapd snapd-xdg-open
sudo snap install notepad-plus-plus
* Interpreter
sudo apt-get install python


Update

Kernel

Update to the latest kernel

  • sudo apt-get update && sudo apt-get upgrade && sudo apt-get dist-upgrade


System Configue

Linux System Configure File

Header text Header text Note
cat /var/log/kern.log kernal log -
cat /proc/cpuinfo cpu info -
/etc/hosts hosts file
nano /etc/passwd edit users
  • test:x:503:503::/home/test:/bin/bash
  • set the user: login name, password, ID, groupID, comment paragraph, main directory, shell, etc
nano /etc/group edit groups
  • debian-transmission:x:117:root,pi
  • user root and pi are in group debian-transmission

Set Path

Example for root

  • .bashrc file locate in ~/.bashrc
  • list by command ls -al
  • Set path in ~/.bashrc, or ~/.bash_profile

Export for HTTP, HTTPS, FTP

export http_proxy="http://127.0.0.1:8118"
export https_proxy="http://127.0.0.1:8118"
export ftp_proxy="127.0.0.1:8118"

For ESP

export PATH=$PATH:$HOME/esp/xtensa-esp32-elf/bin

Test

  • echo $PATH: output: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/he/esp/xtensa-esp32-elf/bin
  • verify: xtensa-esp32-elf-gcc -v

Alias

  • Or use alias: alias get_esp32="export PATH=$PATH:$HOME/esp/xtensa-esp32-elf/bin"

Set System Auto Start

  1. ’‘’init.d‘’‘ directory names within directory put the startup script for each service, such as sshd, httpd etc.
  2. ‘’‘rcX.d’‘’ directory name, followed by the X stands for each run level. Each service within the directory has links to the startup script file in the init.d, according to the file name link to the start-up state. K said they did not start at the beginning of the service, S starts showing links rc.local file to start the service, referring to the /etc/rc.d/
  3. ’‘’rc.local‘’‘ After the system is initialized and services are ready, the final execution of a script, you can put some simple scripts which
  • Methods /etc/rc.d/rc.local or /etc/rc.local
  • Methods update-rc.d: this can run it as service, /etc/init.d/

Disk Operation

Main Header text Header text
check available disk fdisk -l Example
check disk and also mounted on df -h Example
list the mounted disk lsblk Example
list usb disck lsusb
mount disk
  • mount -t ntfs /dev/sda1 /mnt/
  • mount -t auto /dev/sda1 /media/SSK

Mount Disk

  • Install ntfs-3g format: apt-get install ntfs-3g
  • Error cause ((device sda1): load_system_files(): $LogFile is not clean. Mounting read-only. Mount in Windows.)
  • mount on start, first run: sudo blkid

you will see

/dev/mmcblk0p1: SEC_TYPE="msdos" LABEL="boot" UUID="15CD-3B79" TYPE="vfat"
/dev/mmcblk0p2: UUID="13d368bf-6dbf-4751-8ba1-88bed06bef77" TYPE="ext4"
/dev/sda1: LABEL="SSK" UUID="C494B1E694B1DADE" TYPE="ntfs"
  • edit fstab: sudo nano /etc/fstab
  • insert the ntfs type: UUID=DA9C8D0E9C8CE5FB /media/disk ntfs gid=root, uid=root, dmask=002, fmask=113 0 0
  • which means <file system> <location> <type> <gid?> <uid?> <dmask to directories> <fmask applies to files> <?> <?>


  • you have to format it to ext3 or ext4 format firstly, use commoand mkfs.ext3
  • change group and write permission that is the same process above
  • operation not permitted

MISC

Set Command -
Hosts DNS /etc/hosts for DNS -
hostname /etc/hostname -
Alias nano ~/.bashrc -
Run on daemon
  • nohup python main.py &
  • check -> ps ax | grep test.py

Set password for Ubuntu or Lubuntu

  • sudo passwd -> enter current password, and enter new password for root
  • su root -> use the passwod just set can login, can now set

Pages in category "Linux Config"

The following 3 pages are in this category, out of 3 total.