Common commands of linux operating system

1. File and disk operations

man/info #View command usage

cd #change switch directory

ls(-a -l -h -t) ##Display files or directories
-l #List file details (list)
-a #List all files and directories in the current directory, including all hidden ones (all)
-h #Display by file directory name
-t #Display file directory name by modification time

cp(-R -f -l) ##copy-
R/r: recursive processing, process all files and subdirectories in the specified directory together;
-f: forcibly copy files or directories, regardless of whether the target file or directory has been Exist;
-l: establish a hard link to the source file instead of copying the file;

mv ## move or rename

cat/less/more ##View file content/paginate display text file content

pwd ##Display current directory

mkdir ##Create a directory
-p ##Create a directory, if there is no parent directory, create (parent)

rm(-r -f) ##Delete files
-r ##Recursive deletion, can delete subdirectories and files
-f ##Forcibly delete

chmod [-R] user[:group] file ##User permission setting
-R or --recursive: recursive processing, processing all files and subdirectories in the command directory together;
chown user:market f01 //put File f01 to uesr, add to the market group

find(-name -user)
-name<template style>: specify a string as the template style for finding files or directories;
-user<owner name>: find the file or directory with the specified owner name;

grep
(full search for regular expressions and print lines) is a powerful text search tool that uses regular expressions to search for text and print the matching lines.

df(-h) ##View disk size
-h #Display disk information with units The
df command is used to display the available disk space on a disk partition. The default display unit is KB. You can use this command to obtain information such as how much space is occupied by the hard disk and how much space is left.
-h or --human-readable: Display information in a more readable way;

mount /umount ##mount/unmount
the mount command is used to mount the file system to the specified mount point. This command is most commonly used to mount the cdrom, so that we can access the data in the cdrom, because you insert the CD into the cdrom, Linux will not mount it automatically, you must use the Linux mount command to manually complete the mount.
The umount command is used to unmount a mounted filesystem. You can umount a filesystem by device name or mount point, but it's best to unmount by mount point to avoid confusion when using bind mounts (one device, multiple mount points).

clear ##Clear the screen

time ##Count the total time spent by a given command

2. User management

useradd (-g -d -s -G) ##User creation The
useradd command is used to create new system users in Linux. useradd can be used to create user accounts. After the account is established, use passwd to set the password of the account. And use userdel to delete the account. Accounts created using the useradd command are actually stored in the /etc/passwd text file.
-g<group>: specify the group to which the user belongs;
-d<login directory>: specify the starting directory when the user logs in;
-s: specify the shell used by the user after logging in;
-G<group>: specify Additional groups to which the user belongs;

userdel (-r) ##User deletion
-r: Delete all files related to the user while deleting the user.

passwd ##Password modification
passwd command is used to set user authentication information, including user password, password expiration time, etc. System administrators can use it to manage system user passwords. Only administrators can specify user names, and general users can only change their own passwords.
#When using root to change the password, no matter what password is set, it can be passed. Even reminding passwords is too simple.

The groupadd/groupdel
groupadd command is used to create a new workgroup, and the information of the new workgroup will be added to the system file.
The groupdel command is used to delete the specified workgroup. The system files to be modified by this command include /ect/group and /ect/gshadow. If the group still includes some users, these users must be deleted before the group can be deleted.

gpasswd(-a -d)
The gpasswd command is a management tool for the workgroup files /etc/group and /etc/gshadow under Linux.
-a: add user to group;
-d: delete user from group;

su ##User identity switching The
su command is used to switch the current user identity to another user identity. When changing, you must enter the user account and password to be changed.

kernelversion ##Print the major version number of
the kernel Used to print the major version number of the current kernel

hostname ##Display
hostname The hostname command is used to display and set the hostname of the system. The environment variable HOSTNAME also holds the current hostname. After the hostname is set using the hostname command, the system does not permanently save the new hostname, and the original hostname remains after restarting the machine. If you need to permanently modify the host name, you need to modify the related content of /etc/hosts and /etc/sysconfig/network at the same time.

3. Software installation

rpm ( -i -e -ivh -U -q -qa -qd -ql -qi -qR) ##Installation file (you can also use yum to install directly under redhat)
-i #Specified installation kit
-e #Delete the specified The suite
-v #display the instruction execution process
-h #list the flags when the suite is installed
-U #upgrade the specified suite
-q #use the query mode, when any problems are encountered, the rpm command will ask the user-a
#query all suites-
d #List only text files
-l #Display the file list of the
suite -R #Display the association information of the suite

tar ##Packaging and Compression
Using the tar command, you can package a large number of files and directories into one file
-c ##Archive file-
x ##Compressed file
v ##Display the compression or decompression process

4. Network commands

ifconfig(up/down) ##View network conditions
ifconfig command is used to configure and display network parameters of network interface in Linux kernel. The network card information configured with the ifconfig command does not exist after the network card restarts and the machine restarts. If you want to store the above configuration information in the computer forever, you need to modify the configuration file of the network card
up: start the specified network device;
down: close the specified network device;

netstate (-t -p -u) ##Display network status information
The netstat command is used to print the status information of the network system in Linux, which allows you to know the network situation of the entire Linux system.
-t or –tcp: Display the connection status of the TCP transport protocol;
-p or –programs: Display the program identifier and program name that are using Socket;

5. Process management

ps (-a -f -x) ;
The ps command is used to report the process status of the current system.
-a: Display programs executed under all terminals.
-f: Display UID, PPIP, C and STIME fields.
-x: Display all programs, regardless of terminal.

The pstree -pu
pstree command displays the derivation relationship between processes in the form of a tree diagram, and the display effect is more intuitive.
-p: Display program identification code; -u: Display user name;

kill -9 pid ##Forcibly close this pid process

ldconfig #The main purpose is to search for sharable dynamic link libraries in the default search directories /bin and /usr/lib and the directories listed in the dynamic library configuration file /etc/ld.so.onf, and then create dynamic installations. The connection and cache files required by the program.

Killall ##Kill all processes in the same process group, you can also specify the process name to kill. (eg: killall httpd)

reboot ## reboot

halt ##shutdown

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325811719&siteId=291194637