change directory - change directory
cd ~
: Enter the user's home directory
cd ..
: return to the parent directory
show directory - list
ls
: show non-hidden files and directories (-a includes show hidden)
ll
: display a list of the contents of the directory in long format
create directory - make directory
mkdir /usr/test
: Create a test folder under usr
Manipulate files - move - copy
mv aaa bbb
: Rename the file aaa to bbb
mv /usr/* .
: Move all files under the usr file to the current folder
cp file1 /usr/men/tmp/file2
: Copy the file file1 to the directory /usr/men/tmp and rename it to file2
unzip files
tar czvf my.tar file1
: single file compression and packaging
tar czvf my.tar file1 file2,...
: multiple files compression and packaging
tar czvf my.tar dir1
: single directory compression and packaging
tar czvf my.tar dir1 dir2
: multiple directories compression and packaging
tar xzvf my.tar
: unpack to the current directory
gzip -d FileName.gz
:decompress
gzip FileName
:compress
Edit configuration file
vi file1
: edit file1 file
i
: enter insert edit mode
:
: enter command mode
wq
: save and exit
q!
: do not save and exit
firewall
service iptables status
: Check the firewall status
service iptables start
: Temporarily turn on the firewall
service iptables stop
: Temporarily turn off the firewall
chkconfig iptables on
: Turn on the firewall
chkconfig iptables off
permanently: Turn off the firewall permanently
CentOS7
firewall-cmd --state
: Check firewall status
service firewalld start
: Turn on firewall
service firewalld stop
: Turn off firewall
restart the network card
centos:sudo service network restart
ubuntu:sudo /etc/init.d/networking restart
process - process status
ps
: report the process status of the current system
kill
: kill the process
find
find / -name *filename*
: find files
summary
For record only, easy to view and update