"Linux Command"
LS lists the files in the current directory
PWD Current Path
CD changes the current path
Touch Create File
mkdir Creating a Folder
Clear Empty Command Window
Ls-a display all files in the current directory (including hidden files)
LS-L displays all files in the current directory as a list
Ls-h file calculation size style display
Ls-alh Mixing
ls--help view ls parameter documentation
Man ls ls parameter document (separate page, Q key launched)
TAB Auto-Complete
Two times tab displays all files or paths that can be complete
gedit filename Open a file with an editor
Cat file name view file contents (b page forward, F page backward) can view multiple file contents at the same time
More filename percent Paging Form view file contents (b page forward, F page backward)
Historical History Command (! History number command to perform historical numbering)
RM File name Delete file
The LS character + "*" number lists the file that begins with the character (the asterisk is a wildcard character and can be adapted to any characters)
ls character + "?" Number lists files that begin with a character (? is also a wildcard, but can only fit one character)
LS character + "[12345]" + character lists files with a number in the middle and ranges between 1 and 5
ls > Abc.txt Save the results of LS to abc.txt (redirect)
The results of LS >> abc.txt save LS are appended to the Abc.txt (also redirected)
Ls-alh/bin | More save the file under the bin as a list to the pipeline, and use more to view
Command 1; command 2 multiple commands are separated by semicolons, and the results are displayed together
Cd.. /.. Go back to the first layer of the path
CD-Go back to the last directory (remember only once)
CD ~ Skip Home Directory
CTRL + C does not execute commands
Tree displays the directory trees under the current path
mkdir a/b/c/d/e-p Creating nested folders (-p for automatic creation)
RmDir folder to delete empty folders
RM Folder-R can be deleted unless empty folder (-R for recursive folder)
MV original filename new filename update file name
MV filename Path moves the file to the specified path
Ln-s file name Shortcut name Soft Connect (equivalent to creating a shortcut to a file)
ln filename Shortcut name hard link (equivalent to a new name for the file data)
The difference between soft and hard links: The soft connection is invalid when the file is deleted, but the hard link is still valid
LS-LH will show the number of hard links in the file, and the system will actually delete the file if the number of hard links is 0 o'clock.
grep "string" filename to go to the file to find the string containing the specified string
Grep-n "string" filename to go to the file to find the string containing the specified string, and display the number of rows
Grep-v "string" filename to go to the file to find a string that does not contain the specified string (inverse selection)
grep "^ string" filename go to the file to find the string at the beginning of the specified string
grep "string $" file name go to the file to find the string at the end of the specified string
CP filename Path Copy file to specified path
CP Folder path-r copy folder to specified path
Find/-name "*name*" finds files with name in the root directory (not enough permissions to add sudo)
TAR-CVF Test.tar *.py Package all py files to Test.tar
TAR-XVF Test.tar Decompression Test.tar
TAR-ZCVF test.tar.gz *.py Package and compress all py files to test.tar.gz
ll is equivalent to Ls-la
TAR-ZXVF test.tar.gz Decompression test.tar.gz
TAR-JCVF yyy.tar.bz2 *.py compressed into bz2 asked file
TAR-JXVF yyy.tar.bz2 Decompression
Zip zzz.zip *.py Compression
Unzip Zzz.zip Decompression
The location of the which command command
Ps-aux View All Processes
Top current process performance changes in real time
Htop more detailed process performance
Kill-9 Process ID Kill process (-9 coercion)
Shutdown-h now 20:20 20:20 close the machine immediately
Reboot restart
Current computer usage of DF
Ifconfig Viewing network information
Ifconfig | grep 172 looks for network information starting with 172
sudo useradd account name-M Create a new account (can be seen under home)
CAT/ETC/PASSWD View Account
sudo passwd account name set account password
SU account name switch account
WHOAMI View Current account name
Exit exiting current Account
Linux is a multi-user multitasking system, and win is not a multi-user system
SSH user name @ip address remote login to a computer a user
ctrl+shift+t Ubuntu Command Window opens multiple windows
Who accounts are landing
sudo userdel account name Delete account
sudo userdel-r account name Delete account and home directory
Su-account name switch account at the same time switch home directory
Sudo-s switch to Super admin root
RWXRWXRWX File Owner rights + permissions of the same group + other people's rights (readable writable executable)
chmod u=rwx 2.py Modify owner file permissions
chmod G=rx 2.py Modify the same group file permissions
chmod o=rwx 2.py Modify other people file permissions
chmod u=rw,g=rx,o=rwx 2.py Modify file permissions at the same time
chmod 137 2.py Simultaneously modify file permissions (r=4,w=2,x=1 combination)
sudo groupadd group name creates a group
groupmod+ the TAB key to display all group names several times
sudo userdel group name Delete Group
CHGRP new group name file name to change files to a new group
Chown New User's file name to modify the owner to the new user
"VI command"(vi and VIM Universal)
Vim filename New File
I insert before cursor (command mode, edit mode)
I (uppercase i) insertion at the top of the cursor line (command mode, edit mode)
A post-cursor insertion (command mode, edit mode)
A cursor is inserted at the end of the line (command mode, edit mode)
o Cursor Next line insertion (command mode, edit mode)
O line insertion on the row of the cursor (command mode, edit mode)
I (uppercase i) insertion at the top of the cursor line (command mode, edit mode)
ESC enters command mode
Colon into the last line mode (command mode, last line mode)
Wq Save exit
(Command line mode)
YY Copy the cursor in this line (a few lines before adding a number)
P paste below the line where the cursor is located
DD cut the line of the cursor (preceded by a few lines to cut the number of rows)
H cursor moves to the left
L MOVE the cursor to the right
J Cursor moves down
K Move up the cursor
M cursor moves to the middle row of the current page
L cursor moves to the bottom of the current page
H cursor moves to the top of the current page
Ctrl+f PAGE Down
Ctrl+b PAGE Up
Number +g cursor jumps to the first few lines
G cursor jumps to the bottom
GG cursor jumps to the first line
W jumps back to the beginning of the next word
B jumps forward to the beginning of the previous word
D cut the contents of the cursor to the end of the line
U undo just the action
Ctrl+r Anti-Revocation
D0 cut the contents of the cursor to the beginning of the line
X Delete the character at the current cursor location
X Delete one character before the current cursor
V. V Select a piece of code
>> move code to the right
<< move code to the left
. Duplicate Code Execution
{Jumps up one code fragment
Skip down one code snippet
R replaces one character
R replace cursor and subsequent characters
/String Lookup string (n find the next n to go up the previous)
:%s/string/new string/g Replace all strings into new string
1,10s/string/new string/g Replace all strings between the first line and line 10th into a new string
Q exit
Q! Do not save exit
Shift+zz Save exit
"Directory Structure"
/root directory
Bin installation Program
Boot UBUNTN Boot Related
CDROM disc related
Dev Device Related
ETC configuration
LIB Library
Home Directory
. Current path
.. Previous Layer Path
Linux Common commands