0.ls-lh
humanized display the properties of files in the current directory
1. Links:
Hard link (itself a file pointer, and the original file pointer equivalent)
ln filename1 filename2
Soft link (itself a pointer that creates a pointer to the original file)
Ln-s Absolute Path filename2
2. Search:
File Search
Locate (fast, but only search by file name)
Search in database/var/lib/mlocate updated daily
Force update UpdateDB or locate locate
Configuration file/etc/updatedb.conf
Find (powerful, slow, hard)
Find Path-name filename
(-iname is case insensitive
-user Search by Owner
-nouser Search for files with no owner,
Junk files or kernel files or foreign files
)
Search content exactly match, otherwise add wildcard *? []
Eg:find/root-name "AB[CD]"
find/var/log/-mtine +10
Find files that were modified 10 days ago
(-10 files modified in 10 days
10 10 days of modified files on the same day
+10 files modified 10 days ago
-atime File access time
-ctime changing file properties
-mtime Modifying file contents
-size File Size k M
-inum I node check file name
)
Find/etc-size +20k-a-size-50k
-A logic and
-O Logic or
Find cmd1-exec cmd2 {} \;
-exec cmd {} \; fixed collocation
CMD1 processing results for CMD2 treatment
Command Search
Whereis command name
You can only check system commands.
which command name
Show command aliases
String search
grep [Options] string filename
-I ignores case
-V excludes the specified character set
3. Help
Man-f cmd
Equivalent to Whatis cmd
Apropos cmd
Find help information about CMD
CMD--help
Shell Internal Command Help
Help cmd
Use Whereis cmd to determine if CMD is an internal command
Info cmd
Huge and detailed help
4. Compression
Zip Zipname SrcName
-R Compression Directory
Unzip zipname filename
Extract without parameters, source file reserved
Gzip source file (source file disappears)
-R compression directory (files in directory)
-D Decompression Gunzip
Bzip2 source file (cannot compress directory)
-K Preserve Source files
-D Decompression BUNZIP2
TAR-CVF package file name source file
(-C Packaging
-X Unpack the package
-V Procedure
-f Specifies the package file name
)
TAR-ZCVF compressed file name source file
(-Z. gz
-j. bz2
)
TAR-ZXVF Compressed Package-C Decompression Location
-C Specify decompression location
TAR-ZTVF Compressed Package
-T view files within the archive, do not press
5. Turn off the machine
shutdown [Options] Time
-R Restart
-H shutdown halt poweroff Init 0
-C cancels the previous shutdown command
Init 6 (?? Trying to fix??)
Logout (exit remote management terminal)
6. Mounting
Mount View Mounted Directory
Mount-a automatically mount the contents of the/etc/fstab
Mount [-t file system] [-o Special Options] device file name mount point
-T Ext4 iso9660
Mount-o remount,noexec/home/
Re-mount/home cannot execute executable file
Mount-o remount,exec/home/
Re-mount/home
Mounting discs
Mkdir/mnt/cdrom
Mount-t iso9660/dev/sr0/mnt/cdrom/
Unloading
Umount device file name or mount point
Mount USB Drive
Fdisk-l
Mount-t vfat/dev/sdb1/mnt/usb/
The-t option can be omitted in general
7. Viewing logged-in user information
W
W.H.O.
Last read of/var/log/wtmp
Lastlog/var/log/lastlog
8.shell
/etc/shells contains a Linux-capable shell
Enter the shell name to enter the specified shell
Script execution
chmod 755 filename.sh
./filename.sh
Bash filename.sh
Alias
Alias view system already has aliases
Alias ls= ' ls--color=never '
Alias rm= ' RM-RF '
Unalias aliases
~/.BASHRC alias environment variable configuration file
Shortcut keys
CTRL + C termination
Ctrl+l Clear Screen
Ctrl+u Delete all characters before the cursor
CTRL + a cursor jumps to the beginning
Ctrl+e cursor jumps to the end of the line
CTRL + Z put the command in the background
Ctrl+r Search in the history command
Historical command
History [Options] [file]
-C Empty History command
-W Save History command to file ~/.bash_history
environment variable configuration file/etc/profile
!n execution of the nth historical command
!! Repeat the previous command
The string repeats the last command that starts with a string
Output redirection
Commands > Documents
Commands >> Documents
Error command 2> file
Error command 2>> file
Commands > Documents 2>&1
Commands >> Documents 2>&1
Commands &> Documents
Commands &>> Documents
Alias fuck= ' ls &>/dev/null '
Commands > Files 1 2> file 2
Input redirect
Wc
Pipe character
; Command 1; Command 2 delimiter, no effect
&& Command 1 && command 2 command 1 execution succeeds to execute command 2
|| Command 1 | | Command 2 command 1 executes 2 not executed, otherwise 2 is executed
Date;locate "L";d ate
LS && echo yes | | Echo no correct yes error no
Command 1 | Command 2 result of command 1 to command 2
Netstat-an | grep established | Wc-l
Wildcard characters
? * [] [-] [^]
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Linux Basic Commands Learning notes