A file Operation command
1) Create an empty file or modify the file time
Touch file name
Command name: Touch
Command path:/bin/touch
Execute Permissions: All Users
2) Delete
RM-RF file name
-R Delete Directory
-F Mandatory
Command name: RM
Command English original meaning: remove
Command path:/BIN/RM
Execute Permissions: All Users
3) Cat file name to view the contents of the file. From beginning to end
Command name: Cat
Command path:/bin/cat
Execute Permissions: All Users
- n list line numbers
4) More filename split screen display file contents
Command name: more
Command path:/bin/more
Execute Permissions: All Users
Space down page b page Up Q exit
5) Head filename Display file header
Command name: Head
Command path:/usr/bin/head
Execute Permissions: All Users
Head-n number of rows file name Specifies the first few lines to display
Head-n 20 file name
HEAD-20 file name
CTRL + C forced termination
Ctrl+l Clear Screen
6) linked files
ln
Command name: LN
Command English original meaning: link
Command path:/BIN/LN
Execute Permissions: All Users
Shortcut
New links that occupy different hard disk locations
Modify a file, both change
Delete source file, soft connection cannot open
Ln-s source File The file name must write absolute path
Two commands that both files and directories can manipulate
1) RM Delete file or directory
2) Copy
Command name: CP
Command English Original: copy
Command path:/BIN/CP
Execute Permissions: All Users
CP Source file target Location
-R Copy Directory
-P Joint file attribute copy
-D If the source file is a linked file, copy the link property
-A equals-pdr
CP aa/tmp/ formerly copied
CP aa/tmp/bb renamed copy
3) Cut or rename
Command name: MV
Command English Intent: move
Command path:/BIN/MV
Execute Permissions: All Users
MV Source File Destination location
mv/root/aa/tmp/
MV AA BB
Three Rights Management
1 Permission bits
-rw-r--r--1 root root 0 08-11 01:45 AA
The permission bit is 10 bits
First bit: represents the file type
- Normal file
d Catalog File
L Link File
Nine-bit Master permission u group permissions g other person permissions o
R- Read 4
W Write 2
x execution 1
2 Modify Permissions
chmod
Command name: chmod
Command English Original: Change the permissions mode of a file
Command path:/bin/chmod
Execute Permissions: All Users
chmod u+x aa AA file owner plus execute permission
chmod u-x AA
chmod g+w,o+w AA
chmod u=rwx AA
chmod 755 AA
chmod 644 AA
3 Permission meanings:
1) permissions on the meaning of the file
R: Read file contents cat more head tail
W: Edit, add, modify file contents VI echo
But does not contain delete files
X: Executable
2) permissions on the meaning of the directory
R: Can query the directory under the file name ls
W: has permission to modify the directory structure. such as creating new files and directories, deleting files and directories under this directory, renaming files and directories under this directory, cutting touch RM mv CP
X: Access to the catalog CD
4 generic and group commands
Chown
Command name: Chown
Command English Original: Change file ownership
Command path:/bin/chown
Execute Permissions: All Users
Chown user name filename Change file owner
Chown user1 AA user1 must exist
Chown user1:user1 aa change Genus Master simultaneous change group
Useradd User name Add user
passwd User name set user password
Four help Commands
1 man command name Help for viewing commands
Command name: Man
Command English original meaning: manual
Command path:/usr/bin/man
Execute Permissions: All Users
2 command--help Common options for viewing commands
Five Find command
1 whereis command name to find commands for command, see also help document location
Command name: Whereis
Command path:/usr/bin/whereis
Execute Permissions: All Users
2 Find search command
Command name: Find
Command path:/usr/bin/find
Execute Permissions: All Users
Find by file name
Find Find location-name file name
Find/-name aabbcc by file name
by user
-user user name to find files according to the master user name
-group group names find files by group name
-nouser to find documents that are not owned by the Lord
/proc
/sys
/mnt/cdrom/ In addition to these three directories
Find/-nouser
Follow file permissions
-name by file name
-size by file size k M
Find/-size +50k
-type type Find by file type F: normal D: directory L: Link
Find/root-perm 644 Search by Permissions
-iname Search by file name, case insensitive
3 grep "string" file name finds the word serial that matches the criteria.
Command name: grep
Command path:/bin/grep
Execute Permissions: All Users
Grep-i "Root"/etc/passwd
-V Reverse selection
-I ignores case
4 Pipe Break
Command 1 | Command 2 execution result of command 1, as the execution condition of command 2
Cat file name | grep "string" extracts a line containing a string
grep "string" file name
Ls-l/etc | More split screen display ls content
Six compression and decompression
. gz . bz2 Common compression formats that can be recognized by Linux
. tar.gz . tar.bz2 Common compression and packaging commands
Compress and package at the same time
TAR-ZCVF Compressed file name source file
TAR-ZCVF aa.tar.gz AA
-Z recognition. gz format
-C: compression
-V: Show compression process
-F: Specify the name of the compressed package
TAR-ZXVF Compressed file name decompression and unpacking
TAR-JCVF Compressed file name source file compression at the same time package
TAR-JCVF aa.tar.bz2 AA
TAR-JXVF AA.TAR.BZ2 Solution Package Simultaneous decompression
View Puzzle Package
TAR-ZTVF aa.tar.gz View Puzzle
TAR-JTVF aa.tar.bz2
-T only view, no pressure
TAR-JXVF root.tar.bz2-c/tmp/ Specify the decompression position
Seven shutdown and restart commands
1) shutdown-h now No special case, use this command
-H shutdown
- R restart
Shutdown-r now
Command name: Shutdown
Command path:/sbin/shutdown
Execute permissions: Root
2) reboot
Command name: Reboot
Command path:/sbin/reboot
Execute permissions: Root
Eight- mount command
All Linux storage devices must be mounted for use, including hard drives
Command name: Mount
Command path:/bin/mount
Execute Permissions: All Users
CD mount
/DEV/SDA1 first partition of the first SCSI hard drive
/dev/cdrom Disc
/DEV/HDC IDE Hard drive CentOS 5.5
/dev/sr0 CD CentOS 6.x
MOUNT-T File System Device description file mount point (empty directory already exists)
Mount-t Iso9660/dev/cdrom/mnt/cdrom
CD Uninstall
Umount/dev/cdrom
Umount/mnt/cdrom : Exit the Mount directory before uninstalling
Fdisk-l
Mount-t Vfat/dev/sdb1/mnt/usb
NineNetwork Commands
1 ping Test network connectivity
Command name: Ping
Command path:/bin/ping
Execute Permissions: All Users
ping-c frequency IP detection network unobstructed
2 ifconfig query native network information
Command name: ifconfig
Command English original meaning: interface configure
Command path:/sbin/ifconfig
Execute permissions: Root
Linux the next day