Ubuntu Terminal commands

Source: Internet
Author: User

The whole computer is zoned for Ubuntu.
Install software When a clear feeling is a lot of things, with the terminal's command line to do is very easy, with the graphical interface is often very complex, and many times there will be permissions, for Ubuntu user rights, now the only feeling is that permissions in Ubuntu is very important, many operations are corresponding to the corresponding permissions
Now put some of the commonly used commands here, so that later on their own use is also convenient, do not have to open several pages appear to see:

The following are online collection, non-original .....

sudo: Commands that require elevation of privilege execution
    • If your directory or file you want to manipulate is not in the same directory as your account, most of the following commands require the sudo command. This is a special command that gives you temporary permissions to modify the system settings. The terminal will ask for your password.
File & Directory class commands
    • pwd :pwd command to see your current path (pwd stands for "Print Current working directory"). For example: Executing the "pwd" command in the Desktop folder will output "~/desktop". Note that Gnome's terminal also displays this information in the window caption-see the screenshot at the top of this page for details.
    • CD : theCD command is used to change the current working directory. When you open a terminal, you are in your home directory. If you want to switch to a different directory, you need to use the CD command. For example:
    • Go to the root directory and enter "CD/"
    • Go to your own directory (home directory) and enter "CD"
    • Go to the previous level of the current directory and enter "CD.." (Translator Note: There is a space between CD and.)
    • Go to the previous operation's directory, enter "CD-"
    • Once into the multi-level directory, enter "Cd/var/www" , will be directly switched to/var subdirectory/www. Another example, "CD ~/desktop" will go to your desktop directory
    • CP : theCP command is used to copy files. For example:the "CP file foo" command will create an exact copy of "file", named "Foo", and "file" will not change. If you are replicating a directory, you have to use "Cp-r directory foo" (replicated recursively).
    • MV :MV Command moves the file to another location or renames the file. See the following example:the "MV file foo" command renames the file "files" to "foo". "mv Foo ~/desktop" will move the file "foo" to the desktop directory, but it will not be renamed. If you want to rename, you have to specify a new name.
    • For ease of entry, you can use the ' ~ ' symbol instead of your home directory.
    • If you add sudo in front of the MV command, the "~" symbol will be used normally, and the terminal will replace it with your own (normal user) home directory. And if you use "Sudo-i" or "sudo-s" to open a root user's terminal, then "~" will refer to the root user's home directory, not your own.
    • RM : This command is used to move or delete files. For non-empty directories, this command cannot be removed.
    • rmdir : The command rmdir is used to delete the "empty" directory. To delete a directory and all of its contents, you need to use rm-r .
    • mkdir : mkdir command to create a directory. For example, mkdir music will create a music directory.
    • man : The man command is used to display the man pages of other commands. You can view the man's own information by executing man man . You can display more information on a page by using " Man & Getting Help".
    • linux/ubuntu tar command detailed use of formats and methods

      format: Tar options file directory list
      Feature: package Backup to file directory
      option:
      -C to create a new archive
      -R Append a file to the end of the archive
      -X to extract the file from the archive
      -O to extract the file to the standard output
      -V Process output related information
      -F to normal file operations
      -Z call gzip to compress the archive, and the-X-time call gzip to complete the decompression
      -Z calls compress to compress the archive, and invokes compress to complete the decompression when it is associated with-X

      For example:

      1. Package and compress all. txt files in the current directory to file this.tar.gz, we can use

      tar czvf this.tar.gz./*.txt

      2. Extract files from this.tar.gz in current directory to the current directory we can use

      tar xzvf this.tar.gz./

System Information Class command
    • DF : Thedf command is used to view the current space usage of each file system. "Df-h" may be the most useful option-it is output in M and g, not in blocks. (-h means "easy to read")
    • The du :du command can show how much disk space is used by one directory. It can show how much space is used for each subdirectory in the directory, or how much space the current directory occupies altogether.
    • - s stands for "Overview, overview", and-h represents "easy to read".
    • The free : The free command is used to view the memory used and remaining in the system. "Free-m" outputs the result in M, which is useful for today's computers.
    • Top : Thetop command is used to view information about Linux systems, running processes and system resources, including the total number of CPU, memory, and swap partition usage and running tasks. Exit top and press "Q" .
    • uname-a : The-a parameter of theuname command is used to view all information about the system, including the machine name, kernel name & version, and some other details. Its greatest use is to view the information of the currently used kernel.
    • lsb_release-a : The-a parameter of thelsb_release command to view the version information of the currently running Linux
    • ifconfig Displays the network interface information for the current system. Add New user
    • the "adduser newuser" command is used to create a new user named "NewUser", create a password for the new user NewUser, and use the following command "passwd newuser" .
Options

The default action of the command is often specified by a certain --parameter modified. For example, the ls command has a- s parameter, so "Ls-s" will show the file size extra. It also has an- H parameter, which outputs the size of the file in a well-readable format. Parameters can be aggregated in clusters, such as "Ls-sh" and "ls-s-H" , with the same effect. Most parameters are long, and the two dash prefixes represent a parameter, so "ls--size--human-readable" is also the same as the command above.

' man ' and get help

man command, info commandandcommand--help Is the most important tool under the command line.

Under Linux, almost every command and every application has a man (manual) file, so simply type "man" command "to see the man page of this command." For example,"man mv" opens the manual page of the MV (Move).

Use the arrow keys on the keyboard to move the manual page and exit with "Q" .

"Man Mans" will look at the manual page of Mans Command, this is a good start!

"Man Intro" is also very useful-it can see "User command Introduction", written very well! is an introduction to a very brief description of Linux commands.

Another is the Info command, which is usually deeper than man. Enter the "infoinfo" command to get an introduction to the info page.

Some software developers prefer to use info instead of man (for example, Debian and GNU developers). So, if you find a very common command or program that doesn't have a man page, try the info page.

Almost all commands accept an- H(or --help) option that outputs a brief description and parameters of the command, and then automatically returns the command prompt. You can enter "Man-h" or "man--help" to view.

Warning: Some software does not consider the- h option to represent help, although this is not the case. You can try the man or info page First, and use the longer option --help.

Search for man documents

If you are unsure which command or program to use, you can try searching for the man file.

    • Man-k foo will search for man files on foo. Try "Man-k Nautilus" .
    • Note: This is the same as the apropos command.
    • Man-f foo simply searches the title of the system man file. Try "Man-f Gnome" .
    • this is the same as the whatis command. Save Input
      Up Arrow or ctrl+p
      Scroll to display the commands you entered earlier. (translator note, similar to MSDOS)
      Down Arrow or Ctrl + N
      Back to the nearer command. (contrary to up arrow, the opposite side scrolls)
      Enter
      When you find the command you want, press ENTER to confirm
      Tab
      A very useful feature. If there is only one option, the command or file name is automatically complete, otherwise a list of all options is given.
      Ctrl+r
      Search for the commands you have entered. When you have entered a very long and complex command and want to repeat it, use this key combination, and then enter a part of the command that will be searched from your collection history. Once you find it, just press the Enter button lightly
      Change Font

      You cannot use the mouse. You can allow the left/right arrow keys to move. When the cursor is where you want it to be, enter inserts Text-ie It will not rewrite the text there.

      Ctrl + A or Home
      Moves the cursor to the beginning of the line.
      ctrl+e or End
      Moves the cursor to the end of the line.
      ctrl+b
      Moves the cursor to the front of the previous or current word.
      ctrl+k
      Deletes the text from the current cursor to the end of the line.
      Ctrl+u
      Deletes the current entire row.
      ctrl+w
      The word before the cursor is deleted.

Ubuntu Terminal 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.