Common Ubuntu commands)

Source: Internet
Author: User

All commands are listed in alphabetical order and only the most common parameters are introduced. After reading them, you will be able to use man in more detail.

Previously, own has published several articles about several commands, such as LS, sudo, and CHMOD. If you cannot understand man, please search for them by yourself :)

Until the day before yesterday, some people asked me how to use the CD command ~~ Think about it too. There must be a lot of commands that haven't been used in win, right? So I decided to write something (from ownlinux)

Apt-get:
The software package management program of the Debian system (its graphic front-end is a new place with great names) will automatically help you deal with dependencies
Common parameters:
Update -- Update the package list with your software source (listed in/etc/APT/sources. List). Run
Upgrade-compare the source software library obtained by the update with the local one (if necessary ).
Install -- install the software package (you can use tab to complete the software package name, which is more convenient)
Remove -- uninstall the Software Package
Purge -- uninstall the software package and delete the configuration file of the software.
Source -- download the software package source code from the source to the current directory (the directory for executing this command) and decompress it (unless the-download-only parameter is specified)
This address is specified by the Deb-Src line in/etc/APT/sources. List.
Check -- used to (automatically) fix (installed) dependencies between software packages
Clean -- clear/var/Cache/APT/archives/cache of all software packages including its sub-directory partial/
Autoclean-is more common than clean. I understand that the cache of earlier versions is deleted and the later version is retained (or include software packages not in the current source ?)
Aptitude:
This is added to PT. His suggestion is that aptitude has fewer crosslines than apt-get, and Tab completion is easier (=. = )~ Probably, shiniu is relatively lazy.
I have to mention the Ubuntu eggs that I have mentioned before: <only for Ubuntu 8.04>
Man apt -- at last we will see "this APT has super power" or "this APT has a super-cow power"
Man aptitude -- we can see that "this aptitude is not super powerful"
Looking at the aptitude parameters, you will understand why aptitude is named "advanced software package management program ".
Common parameters:
Search -- search for the software in the list of all software packages (your source). The search expression can be complex. For details, see man.
Other common parameters are the same as apt-Get.

Cat:
Display (one or more) file content (connections) to standard output
When the text file is very small and you just want to see it and don't want to use a gedit or Vim editor to edit it, You Can cat It. I use it with grep.

CD:
Switch the current working directory
Unlike other commands, This is a shell built-in command, so there is no manual page to read... Enough Foundation, so it will appear in this article (=. =) depressed
Common parameters:
. -- Switch to the current directory (it seems meaningless) (. This directory can be seen through LS-)
... -- Switch to the upper directory
~ -- Return to the home directory (/home/your login name /)

Chmod:
Change the File ACL
The permission bits of the Linux File System can be expressed in two ways. If you have to say in detail, the mouse must be exhausted and cannot be =. =, so only the 8-digit number indicates :)
Brief Introduction: ls-l can display the file permissions, such as (-rwxr-XR-), representing the permissions of three users
The first rwx represents the permissions of the file owner, namely (read, write, and execute), expressed in binary as 111, representing 4 + 2 + 1 = 7 in octal.
The second R-X represents the permissions of other users in the same user group of the file owner, that is, (read, execute). The value is expressed as 101 in binary format, which indicates 5 = 4 + 0 + 1 in octal.
The third R-represents the permissions of other users, that is, (read,). The binary value is 100, which indicates 4 = 4 + 0 + 0 of the octal value.
Therefore, the permission bit of this file is 754.
This is the usage of CHMOD. For example, chmod 751 myfile # sets the File Permission to rwxr-X.
Common parameters:
-V -- list the currently executed steps
-R -- Recursive, that is, changing everything in a non-empty directory to a specified permission

CP:
Copy files and directories
Common parameters:
-B -- make a backup for each existing target file
-D -- if a soft link is encountered, the file to which the soft link is not copied; if the soft link is copied, The Links attribute (number of links) is retained)
-P -- retain the object access permission, owner, and timestamp
-R and-r -- Recursive copy (valid only when a non-empty directory is encountered in the CP process), that is, copy directories, subdirectories, sub-directories .....
-A -- same role as-DPR
-S -- it is not really a copy, but a soft link (symbolic link) for each file)
-U -- same as the-u parameter of the following mv

Head, tail
Like these two names, one is the header of the file, and the other is the tail of the file.
Common parameters:
-N -- specifies the number of output rows (header or tail). If this parameter is not set, 10 rows are displayed by default.

Ifconfig:
Configure the NIC
Common parameters:
No parameter -- list the status of the Active Network Card
-A: lists the statuses of all NICs.
Interface -- specify the NIC name, such as eth0
Up -- wake up the NIC
Down -- disable this Nic
Arp, MTU, netmask ADDR ,... And so on many parameters =. =

Ln:
Create a link for a file
Linux links are divided into two types: hard links and soft links. ln creates hard links by default. You can search for the two types of links by yourself :)
Common parameters:
-S -- create a soft link (symbolic link, which can be understood as a shortcut in Win)
-F -- if the name of the link to be created already exists, delete it

Ls:
Show directory content
Common parameters:
-A -- display all files in the specified directory, including files whose names start.
-L -- displays detailed information about a file, including the file type, permission, modification time, access time, size, and file name ...)
-H -- indicates the file size in the form of easy reading. It is often used with the-l parameter.

Man:
Read Reference Manual ~
ASIDE: HX says this is the most difficult command to learn in Linux. Because you have learned man well, there will be no command to beat you down, =. = invincible
Man can check more than just the command amount (of course, because man is invincible/CH)
Common parameters:
Man Arabic numerals
Arabic numerals 1: executable program (generally a user-installed program, if manpages is provided) and shell commands
Arabic numerals 2: system calls (such as open calls, socket calls, chmod calls, etc.), first install manpages-dev first
Arabic numerals 3: library function call (such as man 3 printf), first install manpages-dev first
.......
When you execute man ls, the result is the same as that of MAN 1 ls, Because ls has only one entry in man manual.
When you want to see the CHMOD call manual page, you must specify MAN 2 CHMOD ~~ Because chmod has more than one entry
When a man is running, he can move up and down through J and K (similar to that in VI). He can search for the next one through/, and find the last match through N and N (similar to that in VI)
Q exit (similar to Vi ....)
Interesting:
Since man itself is a command, even man can be man =. =

Mkdir:
Create a directory
Common parameters:
-P -- if the parent directory does not exist in the given path, the parent directory is created at the same time.

Mount:
Mount a file system (which can be understood as mounting a partition)
Common parameters:
-T -- specify the file system type, such as iso9660 (mounting an ISO image to a CD, equivalent to a virtual optical drive), NTFS, ext3, RFS, etc.
-L -- list all mounted file systems and support volume labels
-A -- Mount all the partitions recorded in fstab
-N -- Do not write/etc/mtab during mounting
-O -- a common parameter that specifies the "option" for mounting a file system, such as noatime, which is suitable for mounting a dedicated BT partition.
MV:
Moving or renaming a file depends on whether the target directory is the current directory
Common parameters:
-B -- back up each existing target file (to prevent overwriting)
-F -- the system does not prompt whether to overwrite the existing target file.
-I -- opposite to the-F parameter
-U -- move a source file only when the source file is updated or the target file does not exist
-V -- display the progress of Moving Files (this parameter is always recommended for individuals to understand what you are doing)

PS, top:
Lists the execution status of the current command. The PS is static, and the top is dynamic ('q' exits when top is top)
PS: this command is more commonly used. I recommend it to you =. =
Most common parameters (PS multi-purpose parameter set, not a single parameter, and used with grep)
-Ef -- list all current process statuses using standard syntax, such as PS-Ef | grep Eva # list the process statuses of Eva.
Aux -- list in BSD syntax ......................................
-Ejh -- list process trees
-Elf -- list thread statuses at the same time

Rm, rmdir:
RM: delete a file or directory. rmdir: delete an empty directory. (This command is useless and can be replaced by RM-R)
Rm common parameters:
-F -- skip directly if the file does not exist.
-I -- a prompt is displayed for each Delete action (=. = if there are too many deletions, it will not be annoying)
-I -- if you delete multiple files (when there are more than 3 files) or recursively delete files (for non-empty directories), a prompt is displayed.
-R and-r -- recursively delete everything in this directory
-V -- display the delete action of each file (this parameter is always recommended for individuals to understand what you are doing)

Sudo, Su:
This is probably the first command to be used after the system is installed, right?
Sudo is mainly used for temporary elevation of permissions. It is mainly used for the Administrator (Super User) permission to run commands. When you need to modify the files/directories that cannot be reached by the current login user
Sudo or Su-C is required. Of course, sudo and Su are not effective in this way.
You can use mongodo to edit the/etc/sudoers file to modify more detailed actions of sudo (for example, remember the password timestamp length). Please be careful when modifying this!

SH:
Interpret and execute on the terminal
Similar to the './' format, but PT gives the difference: './' is only valid for programs with the execution permission under the current directory, 'sh' does not care about this set
Think too. './' is just a file path (in the current directory), but it is hard to say whether the file can be executed.
So SH is always correct.

Shutdown:
Shut down the system. If you stay at tty, use commands such as halt and poweroff.
Common parameters:
+ M -- specify the minute of shutdown delay
-C -- cancel a request waiting for shutdown (you can also turn off the terminal that runs this command :))
Now -- immediate shutdown
Hh: Mm -- manually specify the time (in 24 hours)

Tar:
Package/unpack
This one is not too many taobao...it's all taobao.gz,taobao.bz2.
Like the ps command, tar generally does not use a single parameter, but a combination of multiple parameters. Remember that parameter X is extracted (extract), and parameter C is the creation package (creat ).
Common parameters:
-Xvf-detailed steps to unpackage
-CVF-detailed steps for listing packages
-J --used to describe this is a tar.bz2 package, such as tar-xjvf myfile.tar.bz2
-T -- List objects in the package
-- Append parameters when packaging:
-R -- append to the compressed package
-U -- only append the files updated in the package
-H -- add the symbolic link to the file instead of adding it to the package.
Additional instructions: tar is a very powerful stuff. Common Operations are package and unpackage. For more information about advanced features, see man =. =.

Touch:
Change the file timestamp. The default value includes the modification time and creation time. The default value is the current time. If the file does not exist, it will be created (=. = is it too cool)

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.