Summary of common Linux commands under Ubuntu

Source: Internet
Author: User
Tags switches

Come to the lab for almost one months, barely touching window, has been developed under Ubuntu, and then want to summarize the most commonly used Linux instructions.

(0) su and sudo: get root permission

su switch to root user sudo command switches to the root user, executes the command, and switches back to the current user su liaohuqiang switch back to normal user

(1) Apt: for installing packages

apt list lists packages by name APT Show package details sudo Install Install packages sudo apt Remove Uninstall package sudo apt-get check checks dependent sudo  apt update update available packages list sudo apt upgrade by installation/ Upgrading the software to update the system

(2) PIP: for installing the Python module (not the default command in Linux, install sudo apt install pip yourself)

Install--install to view the option description of the Install command

(3) SSH and SCP: inter- host communication

SSH [email protected] Log on to the remote host SCP local_file [Email protected]:remote_directory Copy Local file to remote host SCP -R local_directory [email protected]:remote_directory Copy Local folder to remote host

(4) Compression and decompression:zip, unzip, tar

Zip-R target.Zipto compress the current directory and subfolders under the directory.ZipTarget.ZipCompresses the current directory and does not compress if a folder is present (because there is no add-R)UnzipSource.Zip-D'folder'Unzip to folder directoryUnzipSource.Zipunzip to the current directoryTar-ZXVF source.Tar. gz-c'folder'unzip to the folder directory, where z represents the gzip attribute, X for decompression, and V for the output of the extracted information, F must have and put the last and after the file name. Tar-XVF source.TarGZ tried a little bit less z is also possible, the effect is ditto

(5) View the storage footprint of the disk:du; View the storage footprint of the file system: DF.

du -S or--summarize displays only the totals, listing only the last added total value.  du -H improves the readability of the information in K,m,g.  DF -H increases the readability of the information in k,m,g units.  DF -T x Displays the file system type

(6) Find command

6.1 Which searches for the location of a system command in the path specified by the path variable, and returns the first search result.
6.2 Whereis can only be used for program name searches, and only binary files (parameter-B), man description file (parameter-m), and source code file (parameter-s) are searched. If the argument is omitted, all information is returned.
6.3 Locate to view the file location with the database. Linux records all the files in the system in a single database file, but the database is not updated in real time.
6.4 Find actual search hard disk query file name.

Find ' *.conf ' current directory Find file with extension. conf updatedb Update Database Locate string quickly finds the content specified in the system database

Whereis python
which Python

(7) File permissions

chmod [Ugoa] [+-=][rwx] File name or path change permissions for a specified directory or file
U represents the owner of the file, G represents the same group of users of the file owner, O represents the other + representatives to increase the permissions,-represents the cancellation permission, = represents the unique set of permissions R readable, W writable, x executable chmod u+x Test the file owner increases the executable's permission with a number representation, which specifies r=4w=2, x=1,chmod 777 test Three users are given the ability to read writable executables chown User name [: Group name] File name or directory change the owning user of the specified directory or file

(8) File and text operations

grepStr/tmp/test in File/tmp/find str in testgrep^str/tmp/test in File/tmp/find lines starting with STR in Testls-LD*/displays all directory files for the current directoryls-L |grep '^d'displays all directory files for the current directoryWC-l Number of statistics file linesWC-WCount the number of wordsls-L |WC-L COUNT the current number of files, and note that the "Total usage" line is subtractedCP-a dir1 dir2 copy directoryMVDir1 DIR2 Mobile/Renaming a directorymkdir-p/tmp/dir1/Dir2 Creating a directory treeRM-f file1 Delete filesRM-RF Dir1 Deleting a directory

(9) Process

PS-e Show All ProcessesPS-f Full format display processPS-U'Liaohuqiang'|grep 'Tmux'Displays the processes executed by the specified user and matches the containing'Tmux'that line of processKill-2PID similar to CTRL +C, you can save the relevant data before the end of the program, and then ExitKill-9PID Direct force end Process Top dynamic display process information top-I do not show any idle or useless process K kill a process N change the number of processes displayed u show specified user p sort by CPU usage Q exit

(10) Network

 ----grep ssh grep ' : ' ifconfig Viewing network card information

(11) Other

Date Show Time WhoAmI Show Current user name  who is currently logged in to the system user information

(Curl is not the default self for Linux, you need to install apt Install curl yourself)

These are just some of the instructions I've used recently.

Finally recommended a Linux instruction learning and Quick Search website: http://man.linuxde.net/

Summary of common Linux commands under Ubuntu

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.