- dpkg -- deb series software package management system
#List the software packages in the current system dpkg -l #Install package dpkg -i packageName.deb #Uninstall package (keep profile) dpkg -r packageName #Uninstall package (delete profile) dpkg -P packageName #Lists the contents of the specified installed packages dpkg -L packageName #Reports status information for the specified package dpkg -s packageName #Search the files in the specified package (fuzzy query) dpkg -S fileName
Difference and correlation between apt and dpkg:
① apt command calls dpkg to install the software package;
② apt command can download software packages, find and install software packages from online sources, and dpkg can only install downloaded software packages;
③ The apt command can automatically pull the dependency of the software package, but dpkg cannot automatically handle the dependency
- pushd and popd
(1) pushd is to push the directory onto the stack, and popd is to pop the directory out of the stack
#Push the / var/log directory onto the stack pushd /var/log
You can use dirs or dirs -v to view the directory in the stack
You can see that the directory at the top of the stack is the directory just added with the pushd command.
pushd +n or pushd -n can be used to change the position of the directory in the stack
pushd +2 #Set the positive third command of the stack to the top of the stack pushd -1 #Set the penultimate command of the stack to the top of the stack
(2) The popd command removes the top of the stack directory and changes the current working directory to a new top of the stack
You can use the popd +n or popd -n command to remove the directory at the specified location in the stack, - is the reciprocal.
- cp -- copy files or directories
cp [options] src dest
-a: This option is usually used when copying a directory. It retains links, file properties, and copies everything under the directory. Its function is equal to dpR parameter combination.
-d: Keep links when copying. The links mentioned here are equivalent to shortcuts in Windows system.
-f: Overwrite the existing target file without prompting.
-i: Contrary to the - f option, a prompt is given before overwriting the target file to ask the user to confirm whether to overwrite. When you answer y, the target file will be overwritten.
-p: In addition to copying the contents of the file, the modification time and access rights are also copied to the new file.
-r: If the given source file is a directory file, all subdirectories and files in the directory will be copied.
-l: Do not copy files, just generate linked files.
#Use the command cp to copy all files in the current directory test / to the new directory newtest cp –r test/ newtest
- mv -- used to rename a file or directory, or move a file or directory to another location
command | effect |
---|---|
mv source_ File dest_ File | The source file name source_ Change file to destination file name dest_file |
mv source_ File dest_ Directory | The file source_ Move file to destination directory dest_ In directory |
mv source_ Directory dest_ Directory | Directory name dest_directory already exists, source_ Move directory to directory name dest_ In directory; Directory name dest_ Source if directory does not exist_ Change the directory name to dest_directory |
mv source_ Directory dest_ File | error |
- rm -- delete a file or directory
rm -r Directory name rm -rf The file name or directory to delete
- top - display
top #Display system process and resource status #Set information update time top -d 2 #Indicates that the update cycle is 2 seconds, and the default is 3 seconds #Displays the specified process information top -p 2515 #Display the process information with process number 2515, CPU, memory occupancy, etc
- ps -- displays the status of the current process
ps -ef #Show all process information
8. free -- displays the usage of system memory, including physical memory, swap memory and kernel buffer memory
#Sometimes it is necessary to continuously observe the memory condition. At this time, you can use the - s option and specify the number of seconds of the interval free -h -s 3
Output the memory usage every 3 seconds, and press ctl+c to stop.
- df -- view the disk space usage of the file system
#Display disk usage df #Display disk usage in inode mode df -i #Lists the types of file systems df -T #Displays disks of the specified type df -h ext4
10. fdisk - program for creating and maintaining partition tables
Displays the current partition fdisk -l
11. scp -- secure remote file copy command based on ssh login in linux system
① Copy from local to remote host
scp local_file remote_userName@remoteIp:remote_folder scp -r local_folder remote_username@remote_ip:remote_folder
local_file: local file
local_folder: local folder
remote_userName: remote user name
remoteIp: remote host ip
remote_folder: remote file folder, i.e. destination address
-r: Copy the entire directory recursively.
② Copy from remote to local
To copy from remote to local, just exchange the last two parameters of the command copied from local to remote
scp remote_userName@remoteIp:remote_folder local_file scp kylin@172.17.193.16: /home/test /home/kylin/ scp -r remote_userName@remoteIp:remote_folder local_folder