Linux Common commands

Source: Internet
Author: User
Tags clear screen parent directory

Some basic common simple Linux commands, want more complex and more comprehensive commands can refer to the following documents!

Friendship Share Linux Common commands Daquan: Link: http://pan.baidu.com/s/1jI3yVCa Password: IMCV

PWD View current path clear clear screen CD Toggle Command(CD Path (relative path and Absolute path)) CD/switch to the root directory CD: Switch to the parent directory CD. /.. Return to the two level directory CD./to the current directory CD ~ Go to the Personal home directory CD-return to the last directory View commands cat more less LSCat View file contents (full content, general file relatively small: Cat file name)Ps:cat a.txtMore can be paged to view the contents of the file, press the SPACEBAR or the ENTER key to view the remaining content less back, the space bar back, the return line down, b to the previous page turn Q exit Note: Windows is case-insensitive, but Linux is case-sensitive CP Copy CommandCP a.txt b.txt Copy a file that is the same as A.txt, named B.txtcp-r a B to copy a folder with the same content as a, named B (one-r from the copy file) (provided that the B folder does not exist) Cp-r B A Copy the B folder and its files to the A folder (provided that the A folder exists) CP a.txt B Copy the file a.txt to the B folder cp-i A.txt B (-I is a hint, confirm the process, such as whether to delete, prevent misoperation) CP A/a.txt. /the file A.txt in folder A is copied to a sibling directory, that is, a same level LS view files and folders in the folder PS: White is a file, blue is a folder, red is a compressed file ls-a view all files and folders (including hidden files) ls -L View File and folder details (abbreviated LL) drwx readable writable executable D stands for folder-represents normal file L represents link file P pipeline file

#cp file2/tmp Copy the File2 file to the/tmp directory
#cp/tmp/file2/home Copy the/tmp/file2 file to the/home directory
#cp/home/file2/tmp/file3 copy/home/file2 to/tmp directory and rename to File3
#cp-P/tmp/file3/home copy/tmp/file3 to/home directory and copy file properties
#cp-R/dir5/tmp Copy the/DIR5 directory to/tmp

MV Move command (cut)You can also change the name of the file MV a.txt b.txt change file A to a file BMV b.txt e to move the file B to the folder E inside MV A.txt. /move file A to the parent directory create command mkdir touchmkdir folder name (Create folder) touch file name (create file) touch update file creation time, if the file does not exist, then create a byte 0 file touch a.txt Delete command RMRM Delete files and folders-I query comments-F Force Delete-R Delete folder rm file nameps:rm b.txt chmod Modify permissions (777 for highest privilege)chmod numeric file name/directory name ps:chmod 777 A.txt
Find FileFind path file name frequently used:-name filename Lookup by name grep looks up characters (strings) in the specified filegrep string filename ps:grep band A.txt finds a string in file a band Whereis is a command to find a folderWhereis folder name such as configuration file, find folder in which path, System folder Pipe | The corresponding connecting symbol |Connect the symbol, the output of the preceding command as the input of the next command ls |grep a meaning: To view all the files in the directory, and then find in these files string containing a file Rpm-qa|grep + software name Find out what software you installed Ps:rpm-qa|grep QQ This means that all RPM packages installed in the system are displayed, and then found in these packages are the RPM packages containing QQ RPM-QA all RPM packages installed in the Display system Note: RPM is a global command, regardless of the directory

history Find input command histories  Ifconfig View IP Address PS View PC process (dynamic), equivalent to the Task Manager Ps-aux display system All process PID is the PID number of the process is unique PS-EF show all running processes and show the command to start the process Top View process (dynamic)Sort by usage Resources Press 1 to see that the CPU is a few cores switching (depending on the CPU) the men are memory of the total memory has been used in memory swap partition, a supplement to memory press Q to exit netstat viewing network conditionsNETSTAT-LUNPT-The parameters are not sorted in order!!! NETSTAT-LTUNP viewing usage of network port processes NETSTAT-LTUNP |grep 80NETSTAT-LTUNP |grep 3306 Find 3306 ports kill PID (PID is the number before the process) kills the processPs:kill 25 port number Kill 1883 PS-EF Show all running processes and startup methods You can start the process by copying the most-later path name Command Service process name start/stop/status for the servicing processStart a service httpd start stop a service httpd stop to view a service status services httpd status

online Help command man helpsMan View the document description of the command for example, the man LS system will show a detailed description of the command LS command name--help help document PS LS--help show a detailed description of the command LS Compress Command TarTar cvf A.tar *.tar//Put all suffixes named *.tar compression to A.tar compression parameters CVF decompression parameters xvf such as about the parameter suffix named. GZ requires Z

Tar cvf abc.tar *.jpg package All JGP files in the current directory into Abc.tar

Tar zcvf abc.tar.gz *.jpg All of the JPG files in the current directory are packaged and called gzip, compressed into abc.tar.gz

Tar xvf Abc.tar unpack the Abc.tar package

Tar zxvf abc.tar.gz extract abc.tar.gz to the current directory

tar CFV package name file names file packagePackage all txt files into a txt.tar file such as tat CFV Txt.tar *txt

Install the software command yum rpmYum install software name//installation softwarePS: yum install setuptool Start command is a graphical interface that will appear after Setup starts Yum Remove software name//uninstall software

Rpm-i Software Name

Find a.txt View file path grep 1 a.txt querying the contents of a string containing 1 from the a.txt file ls |grep A blur view file with a string Rpm-qa|grep + software name find out which software you have installed ********* * * Rpm-i Software name Whereis + file name find the path to which software you have installed PS View server process several methodsPs-aux View system All Processes ************** PS-EF Show all running processes, and start method ********* Top view process NETSTAT-LTUNP See usage of network port process ************* such as net STAT-LTUNP |grep 3306 (port number) Kill PID killing process


VI Start-up and exit
#vi file to edit files
#vi/tmp/file1 Edit the File1 file under the specified directory/tem
: W Save changes
: Q Exit VI
: Wq Save and exit
: q! Force exit VI, do not save changes

Linux Common commands

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.