Common Linux operations
Since the blogger bought the ubuntu server last year, he has actively forced himself to use command line linux In fact, it is found that the efficiency is very high after a little proficiency. After all, you don't need to use a mouse
Of course, if you use a touch pad, such as the force touch touch pad, it is also very convenient. Let's talk about it
Apple Macbook Pro
Common Linux/shell commands
ssh
ssh username@192.168.1.1 #User login name @ server address
scp
scp local_file remote_username@remote_ip :remote_folder #Copy directory scp -r local_folder remote_username@remote_ip :remote_folder
scp local_file remote_username@remote_ip :remote_folder #Copy directory scp -r remote_username@remote_ip :remote_folder local_folder
mv
#Rename File mv [option] file1 file2 #Move files mv [option] file1 destination #Move the directory file. If the directory moved to does not exist, rename the directory name mv [option] destination1 destination2
-i: If a file with the same name already exists in the specified directory, first ask whether to overwrite the old file; -f: No instructions are given when the mv operation wants to overwrite an existing target file;
touch
#Create a readme markdown file touch README.md
mkdir
mkdir mynekopara #Create a folder named mynekopara cd mynekopara
rm
Rm [option] filename rm -r mynekopara #Traverse and delete all files in the mynekopara folder
cat
concatenate
type
cat a.md
man
man vim #You can view how to use the vim command
vim
I-input input mode. If you want to type in vim, you must first use i to enter input mode Esc - Press this key in the upper left corner of the keyboard to launch the input mode U - Undo the command, equivalent to Ctrl+z . - Repeat the command, which is equivalent to Ctrl+shift+z if you know the Photoshop shortcut key Hjkl corresponds to the direction keys V - Enter visual mode, i.e. selected mode Y - Press y to copy the selected text in the selected mode Y - Copy the current line P-Paste : w - Save File : q - Exit : wq - Save and Exit :q!- Exit without saving
chmod
chmod [-cfvR] [--help] [--version] mode file...
[ugoa...][[+-=][rwxX]...] [,...]
U refers to the owner of the file, g refers to the person who belongs to the same group as the owner of the file, o refers to other people, and a refers to all three. +Means to add permissions, - means to cancel permissions, and=means to set unique permissions. R means readable, w means writable, x means executable, and X means only when the file is a subdirectory or has been set as executable.
-C: If the file permission has been changed, the change action will be displayed -F: Do not display an error message if the file permissions cannot be changed -V: Display details of permission changes -R: Make the same permission changes to all files and subdirectories under the current directory (that is, change one by one in a recursive manner) --Help: Display auxiliary instructions --Version: Display version
chmod 777 file
chmod abc file
r=4,w=2,x=1 If rwx attribute is required, 4+2+1=7; If rw attribute is required, 4+2=6; If r-x attribute is required, 4+1=5.
htop
ifconfig
reboot
grep
netstat
Netstat - ntlp//View all current TCP ports· Netstat - ntulp | grep 80//View the usage of all 80 ports· Netstat - ntulp | grep 3306//View the usage of all 3306 ports·
curl
ls
tree
tree file
-
It's almost 0202, and you don't know basic Linux commands yet? -
Tencent Cloud Developer Lab You can learn how to operate Linux