Format Description:
Operation
Concept
Command
Description and examples
Four
Du-sh/sys View the file, folder size/sys/class/scsi_host/host2/scan online Scan disk (new plus hard drive to do this command to find) stat/etc/issue more detailed look at the data
Blue: Directory
Green: Executable file
Light blue: Link file
Red: Compress files
Create the file with the-h file, delete it? Access?
Absolute path
-: Regular file
D: Catalogue
L: Link File
B: block devices (e.g. hard disk, with cache)
C: Character device (not real, not cached) p: Pipe File Example: Command 1 | Command 2 output of command 1 s: socket
DD If=/dev/zero of=f1 bs=1k count=2 from/dev/zero read content to F1 file, Unit K size for 2khexdump-c f3.txt binary view F3 file
Install binary File Modification tool
Rpm-i/run/media/root/centos\ 7\ x8664/packages/hexedit-1.2.13-5.el7.x8664.rpm
HexEdit f3.txt Modify Command
Install the Convert Files tool to convert Windows files to linux files
Rpm-i/run/media/root/centos\ 7\ x8664/packages/dos2unix-6.0.3-4.el7.x8664.rpm
Dos2unix file name unix2dos file name pwd-p Show physical working directory example:/bincd-p switch to physical directory
Ls
LS ll--blok-size=mb file size in MB display ll-h human readable format ls-r recursive ls-d only column directory ls-ld/etc show directory properties ls-1 file branch display ls-s file from large to small sort ls-r file from small to large sort LS- SRL ls-u directory default ordering ll--time=atime/ctime/mtime 2 Viewing files 2 of three times echo Wocao >> 2 write Wocao to file 2
After the 6 version, frequent access to the file, the access time is unchanged. Change: 1 days ago; Atime is older than mtime;
* Performance Optimization
Chattr +a file or directory lock dead file or directory Access time (atime) chattr-a file or directory to unlock file or directory Access time Mount view mount status Relatime delay
Homework:
Displays only hidden files for the specified directory;
Display only directories under the specified directory
Wildcard characters
* represents any number of characters? Represents the 1-character CD ~wang into Wang's home directory ~+ current directory = CD. ~-Previous directory = CD-[ab] Example 1:ll F[ad] See the example of a file with an F heading that may be a or D 2:ll f[a-c]* view a file that is preceded by F with a to C, distinguishing case, such as [a-c] [1-c] Help document: Man 7 glob
Practice
ll l[:d igit:][[: Lower:]] ll [:d igit:]][^[:d igit:]]
ll [^[:alpha:]][[:alpha:]]
Touch
Touch Create empty file security, if there is duplicate name, will not be corrupted > F1 redirect Create F1 file dangerous, duplicate name will be replaced >> F2 create F2 file security
CP Replication
Cp-t copy a file and rename Cp-r copy the folder and the inside of the file \cp original command cp-a reserved properties (permissions, ordinary users to copy the root file, the owner information is not retained) cp-d only copy soft connection, not-d copy soft connect to the content
Practice:
Copy/etc/to/testdir, name by date, command alias
Alias kaobei= "cp-av/etc//testdir/backup date +%F
"
Alias
Unalias nnn Cancel alias nnnunlias-a all cancel
If you want to be permanently valid, define it in the configuration file
For the current user only: ~/.BASHRC
Valid for all users:/ETC/BASHR
Move and rename
MV F1 F11 equivalent to renaming F1 to F11
Delete
Rm-r recursive, delete directory RM-RF Force delete
The mount point cannot be deleted, but it can delete the file inside.
* Performance-Optimized secure free disk space
Example: Large file F1
First > F1
After Rm-f F1
Create a Directory
MKDIR/TESTDIR/AA Create AA directory under TestDir mkdir-p/TESTDIR/A1/A2/A3 create multi-level directory rmdir Delete directory (only empty directory) Rmdir-p/TESTDIR/A1/A2/A3 Delete a multi-level directory (empty directory)
Linux Operations Learning -4--2016 July 26