Order
init 0 shutdown grep filter
rm -rf delete everything
touch create file
mkdri creates a folder (directory)
cat
-n show line numbers
-A include control characters (newline/tab)
linux $
Windows ^M$
file management
bin Commands used by ordinary users /bin/ls, /bin/date
sbin Commands used by administrators /sbin/service
dev Device files /dev/sda, /dev/sda1
root The HOME
home of the root user stores the ordinary user's home directory
lost+ When fsck is repaired, it stores unlinked files or directories
proc Virtual file system, which reflects the kernel, process information or real-time state
usr system files, equivalent to C:\Windows
/usr/local The directory where the software is installed, equivalent to System boot related files stored in C:\Program
boot, such as kernel, grub (boot loader)
etc. Configuration files (system related such as network /etc/sysconfig/network
lib library file Glibc
lib64 library file Glibc
tmp temporary file (globally available Write: Temporary files generated by the process)
var stores some changed files, such as databases, logs, mails....
==Device (mainly refers to storage devices) mount directory==
media default mount point for mobile devices
mnt Mount point for manually mounted device
directory mkdir -v verbose -p recursive ----------------------------- # mkdir dir1 # mkdir /home/dir2 /home/ dir3 # mkdir /home/{dir4,dir5} # mkdir -v /home/{dir6,dir7} //Display detailed information, traverse # mkdir -v /home/dir8/111/22 # mkdir -pv /home/dir8 /111/222 //Including the creation of its parent, there will be no message output
# mkdir -pv/home/{yang/{dir1,111}, niyaun}
==copy cp -r directory -v verbose -f force -n silent
----------------------------------
Usage: cp [OPTION]... [-T] SOURCE DEST
# cd
# mkdir /home/dir{1,2}
# cp -v install.log /home/dir1 //-v show details
# cp -v install.log /home/dir1/yang.txt
# cp -rv /etc /home/dir1 //-r copy folder
# cp -v install.log /home/dir2
#cp -rv source file 1 source file 2 source File N target file //Copy multiple files to the same directory
# cp -rv /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/passwd /etc/grub.conf /etc/hosts .
# cp -r /etc /tmp
# cp -rf /etc /tmp //-f, --force force
# cp -r /etc /tmp
==Move mv
Usage: mv [OPTION]... [-T] SOURCE DEST
# mv file1 /home/dir3 move file2 to /home/dir3
# mv file2 /home/dir3/file20 move file2 to /home/ dir3, and rename it to file20
# mv file4 file5 Rename file4 to file5, the movement of the current position is to rename
== delete rm -r recursion -f force force -v detailed process *wildcard
--------- -----------------------------------
Example 1: rm -rf delete /home/dir1
# cd /home
# rm -rf dir1
-r recursive
-f force
-v Detailed process
example 2:
[root@tianyun ~]# mkdir /home/dir10
[root@tianyun ~]# touch /home/dir10/{file2,file3,. file4}
[root@tianyun ~]# rm -rf /home/dir10/* //Does not include hidden files
[root@tianyun ~]# ls /home/dir10/ -a
. . . file4
Example 3:
[root@ tianyun ~]# rm -rf file*
[root@tianyun ~]# rm -rf *.pdf
User Management
Order
useradd create user userdel delete user usermod add group