Liunx basic operations management operations with files and directories

First, the basic operation

Tab key: auto-completion
ctrl + u: first empty row to
ctrl + k: end of line to Empty

ctrl + l: clear screen

ctrl + c: cancel the editor command
to restart:
reboot
systemctl reboot
the shutdown -r
the init 6
off:
poweroff
systemctl poweroff
the shutdown -h
the init 0
console switch:
Ctrl + alt the Fn + F2-F6] [
View CPU memory usage:
Top
free
to view the system kernel version:
uname -a
view and modify the system name:
hostname
hostnamectl the SET-hostname
view and modify the system time:
DATE
DATE -s "2018-10-1 12:00:00"
Clock -w


Second, file and directory management
view directory or file: ls
create a file:
Touch file_a.txt files created file_a.txt

Copy File:
CP / home / filea / demo lower / home directory are copied to filea / demo directory
cp / home / filea / demo / fileb copy while renaming

Mobile File:
Music Videos / home / filea / demo / filea will move under / home directory under / demo directory
mv / home / filea / demo / fileb simultaneously moved rename

Rename the file:
mv filea fileb the filea Duplicate file named fileb

Add content to the file:
echo HelloWorld> filea the HelloWorld entered into the file filea the
echo haha >> filea file filea additions haha
vi editor

View File:
CAT filea view the contents of the file
file filea view the file types
More filea
less filea
head -n filea
tail -n filea
grep "^ &" filea view reverse lookup string -v -i to ignore case

The package file:
the tar -cvf file.tar
the tar -cvf /demo/file.tar filea fileb the filec
unpacked files:
the tar -xvf file.tar
the tar -xvf file.tar -C / Demo /

Compressed file:
gzip filea fileb filec
gzip -d decompress
bzip2 filea fileb filec
bzip2 -d decompression

Ya_suo bing da_bao
tar zcvf filetargz filea fileb filec
tar jcvf filetarbz2 filea filec

filetargz zxvf tar
tar jxvf filetarbz2

Delete files:
RM filea -f forced to delete not prompt

Change directory:
cd ..
cd / Demo
Create a directory:
mkdir / Demo / the Test
mkdir -p / Demo / Work / the Test

Copy directory:
cp -r source directory target directory

Rename directories:
mv test demo will test directory rename demo

View the current directory:
pwd

Statistical occupied space in the current directory:
du -SH

Packing and compression directory:
tar -zcvf test.tgz the Test
tar -jcvf test.tbz2 the Test

Remove directory:
RM -rf the Test

wc command:
wc file name

find command:
find -name xxx xxx lookup directory or file

ln command
ln source file connection file or directory path to use absolute paths
[-s] Soft connection: the path to the original file
hard link: to the data storage location corresponding to original files
can not establish a connection to the directory
file must be hard-wired to the original file located in the same partition (file system)
nc command
-l
specifies the nc in the listening mode. This parameter is specified, it means that nc is treated as server, listening and accepting connections, rather than initiate a connection to other addresses.
-p <port>
yet used (old version of nc -p parameter may need to add before the port number, the following test environment is centos6.6, nc version nc-1.84, unused -p parameter)
-s
specified the source IP address to send data, suitable for multi-card machine
-u
designated nc UDP protocol, the default is TCP
-v
output an error message or interact with, is particularly useful when debugging novice
-w
timeout in seconds, followed by digital
-z
represents zero, no data is transmitted during a scanning

Guess you like

Origin www.cnblogs.com/lizijiang/p/11240450.html