Linux command summary

Source: Internet
Author: User
Ls & amp; ndash; la lists all command cd to enter the current directory cd .. parent directory cd. the current directory cat displays the file content echo + content & gt; file name (write content) mkdir creates a new directory mkdir & amp; ndash; p create a directory and a subdirectory mkdir at a time to create a directory with spaces...

Ls-l a: list all commands
 
Cd to enter the current directory
 
Cd .. parent directory
 
Cd. Current Directory
 
Cat display file content
 
Echo + content> file name (write content)
 
Create a directory in mkdir
 
Mkdir-p: create directories and subdirectories at a time
 
Mkdir "create a directory with spaces
 
Rmdir delete empty directory
 
Rm-rf: Delete a directory not empty
 
Rm-r does not prompt deletion (recursion
 
File view file type
 
Touch file creation time change
 
Cp copy file
 
Move the music video file to a directory or its lifecycle name
 
Find (.)-name file name to find the file
 
More find more commands (page flip)
 
Less paging and repeated reading
 
Head: displays the file header.
 
Tail: displays the end of a file.
 
Ls/media/cdrom/read disc content
 
Fdisk-l list all storage devices
 
Ls/dev/cdrom-l View disk partitions
 
Mount-t + CD format/directory in which the device/device is stored (disk mounting)
 
Umount/mnt (directory name) unmount (in use cannot be uninstalled)
 
Eject pop-up eject-t reclaim
 
Mount-o loop-t can be directly mounted to the file system.
 
Adduser
 
Passwd (User) change user password
 
Userdel-r: delete a user
 
Usermod modify user attributes-L lock-U unlock
 
Groupadd add user group
 
Groupdel delete group
 
Usermod-g + name added to group
 
Chmod changes User operation permissions
 
Chown modify the owner and Group of the file
 
Chapter 3
 
: E + file name to open another folder
 
: E! + Do not save the file name. open another folder and discard modification.
 
: R + file name switch to another folder
 
: W + save the file name as a file
 
: Q: exit without modification
 
: Wq save and exit
 
: Q! Force exit without saving
 
: M, ny copy the nth row when the nth row is m
 
: S/old/new replace (first of the current row)
 
: Replace all in s/old/new/g
 
: M, ns/old/new replace in m-n rows
 
: % S/old/new/g replace in the entire file
 
: S/old/new/c prompts confirmation
 
: Args displays multi-file information
 
: Next: switch multiple files before and after prev
 
: First: prev (!) Locate the beginning and end files
 
: Ctrl + ^ fast file switching
 
^ Jump to the beginning of a line $ jump to the end of a line
 
W The first letter of the last word where the cursor is located B the first letter of the previous word
 
E. The last letter of the last word, 1 GB, jumps to the first line of the file.
 
G tail line # G jump to line #
 
I insert a cursor at the current cursor and then insert
 
Insert Row A at the end of row A to insert A new row below o
 
O insert a new line above cw delete the tail character of the word where the cursor is located
 
C $ delete the character from the cursor to the end of the line c ^ The character from the front to the beginning of the line
 
Home jump line first End jump to line End
 
Page up Page Down
 
Backspace Delete cursor prefix character Delete cursor position
 
X delete the line where the cursor is located by a single character dd
 
Dw delete the cursor from the beginning to the end of the word de delete the current character to the end of the line
 
D $ delete the current character to the end of the line d ^ delete the character to the beginning of the line
 
J merge the content of the current row and the next row dd + p cut
 
U cancels the last operation U cancels all operations
 
Ctrl + R undo the U command to restore the entire line of yy replication
 
Yw: copy the current cursor to the end of the word y $ copy the cursor to the end of the line
 
Y ^ copy the cursor to the beginning of the line P and paste it
 
/Top-down search? Bottom-up search
 
Chapter 4
 
Main Bash functions
 
Convenient command editing environment
 
Complete functions
 
View history functions
 
Alias function
 
View functions
 
Custom Function key
 
Enriched variable-class commands and control structures
 
Shell variable
 
Ctrl + D log out of the modified environment,
 
Set View environment
 
Common Environment variables:
 
The USER displays the logon name of the current USER.
 
UID indicates the ID of a user
 
SHELL indicates the logon shell of the current user.
 
Logon Directory of the user before the HOME representation
 
PATH: command search PATH of the current user
 
PS1 user primary prompt
 
The default value of the PS2 user auxiliary prompt is ">"
 
Environment variable configuration file:
 
/Etc/bashrc/etc/profile global
 
/. Bash_profile/. bashrc user
 
Predefined variables
 
$ # Number of location parameters
 
$ * Location parameter content
 
$? Status returned after the command is executed. 0 is correct. thank you very much for being an error.
 
$ Current process ID
 
$! The last process number running in the background
 
$0 name of the currently executed process
 
User-defined variables
 
The export output variable is a global variable.
 
Unset: clears User variables.
 
Ctrl + U delete the current cursor to the beginning of the line
 
Ctrl + K delete current cursor to end of line
 
History view command history
 
History-c Clear history Command
 
Command alias stored in/etc/profile. d/
 
Alias command alias
 
Alias name = value ...... Define command alias
 
Unalias-a cancels all aliases
 
Wc calculates the number of characters, the number of words, and the number of lines in the file.
 
Enter the redirection "<"
 
Output redirection ">"
 
Error redirection "2>"
 
Accumulate ">"
 
Error accumulation "2>"
 
Redirection of output and error output "&>"
 
Pipeline operator "|" for example: | more | grep
 
Chapter 5
 
Basic commands in Linux are stored in/bin and/sbin.
 
The executable files of Linux applications are stored in/usr/bin and/usr/sbin.
 
The workarounds are stored in/usr/bin.
 
The server executes the program in/usr/sbin
 
The application configuration file is in/etc.
 
The application documentation file is in/usr/share/doc
 
Document on the manual page is in/usr/share/man
 
Rpm-q query
 
Rpm-qa query all software packages
 
Rpm-qa | grep: check the package containing a certain character.
 
Rpm-qi query details
 
Rpm-ql query file list
 
Rpm-qf + software package for absolute path query
 
Rpm-qpi: query the detailed information of packages that have not been installed.
 
Rpm-qpl displays included items
 
Prm-I install the RPM Package
 
Rpm-ivh displays detailed information when installing the RPM Package
 
Rpm-e uninstall software package
 
Rpm-U upgrade package
 
Preparations before compiling the application
 
Check that the compiling environment has been installed in the system.
 
Rpm-qa | grep gcc
 
Download the source code installation package file of the prozilla program
 
Wget URL
 
Release downloaded source code package files
 
Tar jxf + package name
 
Configuration before compilation
 
./Configure-prefix = absolute path of the program installation directory
 
Compilation and installation
 
Make compilation
 
Make install installation
 
Start the package management program system-config-packages
 
Chapter 6
 
Running level in Linux
 
0 shutdown 1 single user mode
 
3 Multi-User Mode 4 Unallocated
 
5. graphic logon multi-user mode 6 restart
 
Runlevel: displays the current running level of the system.
 
Init changes the running level
 
View the service startup status in chkconfig-list
 
Chkconfig-level sets the service startup status
 
Ps-aux
 
Top view dynamic processes
 
Pstree View process tree
 
Ctrl + Z transfer the currently running process to the background
 
Jobs
 
Fg [background process number] RESTORES background processes to the foreground
 
Kill [-9] PID to terminate the process
 
Killall process names terminate all renamed processes
 
Service crond starus query service status
 
Service crond stop service
 
Service crond start service
 
Service crond restart service
 
Crontab-l view user cron tasks
 
Crontab editing task
 
Crontab-e use the vi editor to edit a task
 
Crontab-r clear task
 
To set a disk quota
 
Modify the "fstab" file vi/etc/fstab, and add the "usrquota" "or" kgquota "option to the partition loading settings for quota configuration.
 
Remount the file system reboot
 
Create the quota file quotacheck-cmug + partition
 
Set the quota of edquota-u edquota-g
 
View quota-u quota-g
 
Quotacheck-mfvug/detection
 
Edquota-t limit time
 
Tar cf tar file name archive file tar czf tar.gz file name compression backup file
 
Tar tf tar file name view archive file tar tzf tar.gz file name view compressed backup file
 
Tar xf tar file name release tar backup file tar xzf tar.gz file name restore compressed tar backup file
 
Tar xf tar file name-C directory name restore archive file to the specified directory tar xzf tar.gz file name-C directory name restore compressed archive file to the specified directory
Recording
 
Chapter 7
 
Common User
 
/Sbin/ifconfig users can view network interface devices and IP addresses
 
/Sbin/ifconfig eth0 view the specified network interface information
 
/Sbin/ifconfig-a view all style interface information
 
/Sbin/route View host route information
 
Ping/traceroute + address depends on connectivity
 
Ping-c quantity address ping several times
 
Hostname
 
Nslookup displays the current default DNS
 
Dhclient automatically obtains the IP address
 
Ifconfig eth0 IP address netmask make address configuration IP address
 
Route del default gw gateway deletes the default gateway route
 
Route add default gw gateway add default gateway
 
Netconfig network configuration using tools
 
Service network resrart restart interface service
 
/Etc/init. d/network restart interface service
 
Ifdown + network interface name disable network interface
 
Ifup + network interface name enable network interface
 
 
 


/Etc/sysconfig/network-scripts/ifcfg-eth0 network interface configuration file
 
/Etc/sysconfig/network host name configuration file
 
/Etc/hosts host name resolution file
 
/Etc/resolv. conf domain name server configuration file
 
Chapter 8
 
Run the rpm-q nfs-utils portmap command to check whether the software packages nfs-utlis and portmap are installed.
 
The NFS configuration file of the server is saved in/etc/exports.
 
Exports file format:
 
Nfs shared directory name client host address setting option
 
Example:/var/ftp * (sync, ro)
 
Client host address: specifies the IP address, the specified domain, the specified network segment, the specified domain, and all hosts
 
Setting options: sync synchronization, ro read-only, rw read/write
 
Service program name starus View Server Status
 
Service portmap/nfs restart/srart/stop restart/Start/close the service
 
Showmount-help information
 
Showmount displays the NFS server information of the host.
 
Showmount-e: display the output directory list of the NFS server
 
Showmount-d: Display the shared directory mounted to the NFS server
 
Showmount-a displays the shared directory mounted to the server client.
 
Exportfs-rv: output all directories again
 
Exportfs-stops outputting all directories
 
Exportfs-av enables output to all directories
 
Mount-t nfs NFS server address: shared directory local mount point mount NFS shared directory
 
Mount | grep mnt
 
Umount/mnt/uninstall the shared directory
 
/Etc/fstab system Automatic mounting
 
Cp-dpr/media/cdrom/*/var/ftp/pub/network installation

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.