Chapter 5. System Category Structure
ls = list
useradd XXX (home category is /home)
authorized_keys must be under .ssh (stipulated by sshd configuration ----- ls /etc/ssh/sshd_config)
Catalogue
bin & sbin
command under sbin is basically used by root account and bin is used by normal account (sbin means super bin)
boot
boot up related files (grub- like singleuser mode)
dev
device files(mouse, keyboard etc..)
/etc
system configuration files (Network card setup files: ls /etc/sysconfig/network-scripts/ifcfg-ens33 & ls /etc/ssh/sshd_config)
Excerpted from https://zhidao.baidu.com/question/398779738.html
/home
home category of users
lib & lib 64
for dll (Dynamic Link Library)
Excerpted from https://baike.baidu.com/item/%E5%BA%93%E6%96%87%E4%BB%B6/2550595
/proc
Excerpted from https://www.cnblogs.com/DswCnblog/p/5780389.html
/run
Temp file when system progressing, only exsit before system reboot
/sys
core related files
/tmp
temp directory
/usr
user files
/var
Excerpted from https://zhidao.baidu.com/question/398779738.html
/var/log : log files
Chapter 6. Frequent command
/tree (install command firstly: yum install -y tree)
Man tree
tree -L (level, max display depth of the directory tree) eg. Tree -L 2 /
/ls
*inode please refer to https://www.cnblogs.com/itech/archive/2012/05/15/2502284.html
**File type
capital letter
"d" for directory
"-" for normal file (can be checked by "cat" command directly)
"c" for character device (yellow color), mouse keyboard, tty file
Excerpted from https://baike.baidu.com/item/%E5%AD%97%E7%AC%A6%E8%AE%BE%E5%A4%87/6637035
"b" for block device (disk)
“s” for socket file. communication, data transmission
"l" for symbolic link. 符号链接 又称软连接,包含了另一个文件的绝对路径或者相对路径
Excerpted from https://baike.baidu.com/item/%E5%A5%97%E6%8E%A5%E5%AD%97/9637606?fr=aladdin
alias
Add new command (fred) into alias: alias fred='ls -lha' / unalias to cxl the comand add-in
CD
cd - alternate to previous command
cd move to the home directory of current directory
cd ~ go back to user's home directory
cd .. go back to previous directory
mkidr/ rmdir and rm
if directory 1/2 needed to be created simultaneously, try to use -p after mkdir/rmdir, (-pv for visually)
touch for file creating touch /tmp/1/2/1.txt
rm unsed to remove the files, use -f after rm command and skip the notification and delete directly
notes ! command also can be used, refer to most recent command in history
!$ refer to the last character in most recent command in history
rm -r to remove all directory and files
cp
cp A B
cp -r if copy a directory
Chapter 7. Path
mv
file move and name change
*如果在同一个目录下那就是改名字,如果目标的文件已经存在就会问是否会覆盖,如果目标是一个目录且目录不存在它就会更该目录名字,如果目标是目录源也是一个存在的目录那它就会放在目标目录里面去
File related file command.
Cat check file details
to add contents from cat /etc/passwd into anaconda-ks.cfg.1
tac check file details reversely
more check file details by screen (space move forward, CTRL+B move back)
less command more like "more". but can use search under less (N for next page)
example /cdrom ?cdrom search from bottom to up
shift g and G, set to front row and end row
wc -l check how many rows they have in a file
head check a file with top 10 rows
tail check a file with last 10 rows
tail -n 2 anaconda-ks.cfg.1 check the last 2 rows
tail -f real-time update the latest info
Absolute Path & Relative Path
Excerpted from https://baike.baidu.com/item
if your command is under one of below directory, we dunt need to input absolute Path
How to add /tmp/ into PATH? (temprorary)
How to add /tmp/ into PATH? (permenant)
Chapter 8. Authority
File $ Directory Auth chmod
r-read w-write x-executable
eg.
前三位为所有者权限user:可读写不可执行
中间三位为所属组权限group:仅可读
后三位为其他用户权限other:仅可读
r=4 w=2 x=1, rw-r--r-- =644
change auth for 2.txt
chmod -R 700 fred revise all sub directories under fred
chmod a/g/o/u+x fred/
Chown -change owner
chown and chgrp
change owener and group
Umask
umask 022 by default , directory = 777 file =666
Excerpted from https://baike.baidu.com/item/umask/6048811