Linux Terminal Commands 4

1. System Information

1.1 Time and Date

the Data   # View system time 

CAL   # Calendar view your calendar, -y option to view the calendar year cal 7 2019 View July 2019 Calendar

1.2 Disk Information

-h df   # Disk display as Free disk space 

du -h [directory name]   # Disk Usage displays the file size in the directory

1.3 Process Information

the AUX PS   # details of the process status to view the process of 
# PS default displays only referenced by the current user terminal initiated 
# A: Display all processes on the terminal, including other users of the process 
# U: Display detailed process of 
# the X-: no process controlling the terminal display 

Top   # dynamic display of the running process and the ordering 

kill [ -9] process code   # termination code specified process, forced termination represents -9 
# use kill command, open preferably only terminated by the current user process, rather than terminate the root, open process, it may cause a system crash

2. Other commands

2.1 find

the Find command powerful, usually used in  a particular directory search  qualifying documents

find [path] -name " * .py "   # to find the specified path extension is .py files, including subdirectories

• If you omit the path, it means the search in the current folder

• find command can be used with a wildcard

2.2 soft links

ln -s linked source files [-d] Link File   # founding documents of soft link with popular way of telling similar shortcuts in Windows 
LN source file destination: the target file as the source file hard links 
# no -s option is to establish a hard link file # after the source file using the absolute path, you can not use relative paths, so you can easily move linked files can still be used normally

Soft links are pointing to the file name

  • modify the target file, the contents of the source file is modified will follow.

  • modify the source file, the contents of the link (target) will change along with the file.

  • delete the link file has no effect on the source file.

  • Delete source file, the file link failure.

  • Soft iNode number of links in the source and target files are not the same.

  • Soft links across partitions

A hard link is pointing iNode No.

  •  source and target files of iNode the same number

  •  modify the source file / object file, a file / source file will change

  •  Delete files / target file, the target file / does not affect the source file

  •  Hard links can not cross partitions

  •  hidden files . .. are hard links . Is a hard link to the current directory, and .. is the parent directory of hard links

  • Only the number of hard links to the file will be deleted 0 

2.3 compression packing

• In different operating systems, commonly used compression package is different:

  > Windows common rar 

  > Mac usual zip

  > Linux common tar.gz

2.3.1 packing / unpacking

• tar Linux is the most commonly used backup tool, this command can put a series of files packed into a large file , you can restore a file as a series of large packaged file 

 

# Packaged file 
tar -cvf package file .tar packetized file / path ... 
tar -cvf py.tar 01.txt 02.txt 03.txt
# unpacked files the tar - xvf .tar package file # Option Description c generated archive file, create a package file x unlock the archive file v set out in detail the process of archiving, showing the progress f specify the archive name, f must be behind the .tar file, it must be the last option on the

 

2.3.2 compression / decompression

1) gzip

• tar used in conjunction with gzip command for file  archiving and compression

  > Tar  is only responsible for packing files without compression

  > Gzip  can compress files after the tar package, its extension is generally used xxx.tar.gz

•  There is an option in the tar command  -z  can call gzip, so you can easily implement compression and decompression functions

# Archive 
tar -zcvf package file .tar.gz compressed file / path ... 
tar -zcvf py.tar.gz * .py 

# decompress files 
tar - zxvf .tar.gz packaged file 

# unzips to the specified path 
tar -zxvf packed files .tar.gz -C target path   # -C unzipped to the specified directory, to decompress directory must exist

2)bzip2

•   There is an option in the tar command  -j  can call bzip2, which can facilitate the realization of compression and decompression functions

# Archive 
tar -jcvf .tar.bz2 package file is compressed file / path ... 

# decompress files 
tar -jxvf .tar.bz2 package file

2.4 Software Installation

2.4.1 by apt install / uninstall software

• apt is the Advanced Packaging Tool, is an installation package management tool for Linux

• in the terminal can easily  install / uninstall / update package

 

# Install the software 
sudo apt install package 

# uninstall the software 
sudo apt remove package 

# package installed updates 
sudo apt upgrade

 

 

 

 

 

Guess you like

Origin www.cnblogs.com/ye8381/p/11575254.html
Recommended