I. Common commands for Ubuntu

Source: Internet
Author: User
Tags parent directory

All commands in alphabetical order, only the most commonly used parameters, I believe that when you read, you will have the ability to use man more detailed usage

Before own also published several articles, detailed introduction of a few commands such as Ls,sudo,chmod and so on, do not understand man, please find yourself:)

Until the day before yesterday a group of people asked how to use the CD command. Storm Cold ~ ~ Think also, there must be a lot of win under the command has not been contacted? So decided to write something (transfer from ownlinux)

Debian System software package management program (its graphical front end is the famous new stand), will automatically help you deal with dependencies
Most commonly used parameters:
update--with your software source (listed in/etc/apt/sources.list) to update the package list, which needs to be executed after source change
upgrade--the source repositories based on the update are compared to the locally installed, and (if required) upgrade all
install--Install package (can use tab to complete the package name, more convenient)
remove--Uninstalling Packages
purge--Uninstall the software package and delete the configuration file
source--Download the source of the package from sources to the current directory (the directory where the command is executed) and unzip it (unless you specify the –download-only parameter)
The address is specified by the DEB-SRC line in/etc/apt/sources.list
check--used to (automatically) fix dependencies between (installed) packages
clean--Clear/var/cache/apt/archives/includes all package caches under its subdirectories partial/
autoclean--than clean, my understanding is to delete the lower version of the cache and keep the higher version (or include the software package that is not in the current source?)
This is the PT classmate supplement, his argument is aptitude than apt-get less a horizontal line, tab completion is easier (=.=) ~ Probably God cow are more lazy
Had to mention egg-laying children's shoes previously said Ubuntu eggs:) < Ubuntu 8.04> only
Man apt--will finally see "This apt with Super Bull force" or "this apt has a super-cow power"
Man aptitude--will see "This aptitude no super bull."
Look at aptitude's parameters and you'll see why aptitude is labeled "Advanced Package Manager".
Most commonly used parameters:
search--Search for the software in the list of all packages (your source), the search expression can be very complex, specifically look at the man
Other common parameters with Apt-get

Displays (one or more) file contents (connections) to standard output
When the text file is small and you just want to look at it and don't plan to edit it with a gedit or Vim editor, you can cat a bit and I'm using it with grep

Toggle Current Working Directory
Unlike other commands, this is a shell built-in command, so there is no manual page to look at ... Enough Foundation, so it will appear in this article (=.=) depressed
Most commonly used parameters:
. --Switch to the current directory (seemingly meaningless) (. This directory can be seen through ls-a)
.. --Switch to upper level directory
~--Back to home directory (/home/your login name/)

chmod :
Change the permission bit of the file
Linux file system has two methods of the permission bit, if the detailed said, must be exhausted mouse not =.=, so only say 8 binary number means:)
Brief introduction: LS- L can display the permissions of the file, for example (-rwxr-xr–), representing the rights of three users
the first rwx, representing the permissions of the file owner, i.e. (read, write, execute), with binary representation as 111, representing the 4+2+1=7 in octal
the second r-x, Represents the permissions of other users of the same user group as the file owner, i.e. (read, execute), with binary representation of 101, representing 5=4+0+1
in octal, the third R –, which represents the rights of other users, i.e. (read,,), binary representation of 100, 4=4+0+0 for octal
So the permission bit for this file is 754
This is also chmod usage, such as chmod 751 myfile #将该文件权限设定为rwxr-x–x
Most commonly used parameters:
-v        --lists the steps that are currently being performed
-r       --recursively, that is, change everything under a non-empty directory to the specified permission

Copying Files and directories
Most commonly used parameters:
-b--a backup for each existing destination file
-d--when a soft link is encountered, the file pointed to by the soft link is not copied; The Links property is preserved when copying
-p--Preserve file access, owner, and timestamp
-R and-r--recursive copy (CP process encounters a non-empty directory is valid), that is, copy directory, subdirectory, subdirectory of subdirectories .....
-a--function with-DPR
-s--does not really make copies, but only makes soft links for each file (symbolic link)
-u---u parameter with MV below

Head, tail
Just like these two names, a display file header, a display tail
Most commonly used parameters:
-n--Specifies the number of rows (head or tail) of the output, which displays 10 rows by default when this parameter is not present

Configuring the NIC
Most commonly used parameters:
No parameters--Lists the status of the currently active NIC
-a--list The status of all network cards
interface--Specify the NIC name such as Eth0
up--Wake up the NIC
down--Close the network card
Arp,mtu,netmask Addr,... Wait a lot of parameters =.=

Establish a link to a file
There are two types of links in Linux: Hard links and soft links, ln defaults to hard links, and two types of differences please search by yourself:)
Most commonly used parameters:
-s--Create a soft link (symbolic link that can be understood as a shortcut under win)
-f--if the link name you want to establish already exists, delete the

Show Directory Contents
Most commonly used parameters:
-a--displays all files in the specified directory, including the file name. The file that starts with
-l--Show file details (including file type, permissions, modification time, access time, size, file name ...)
-h--the file size in a convenient reading form, with the-l parameter, often miraculous

Read the reference manual of~
Off-topic: HX said this is the most difficult to learn Linux commands, because man you learned, there is no command to defeat you, =.= Invincible
Man can not only check the command amount (of course, because man is invincible/ch)
Most commonly used parameters:
Man Arabic numerals
Arabic Numerals 1: Executable program (typically user-installed programs, if Manpages is provided) and Shell commands
Arabic Numerals 2: System calls (such as open calls, socket calls, chmod calls, etc.), first loaded Manpages-dev first
Arabic Numerals 3: library function calls (e.g. Man 3 printf), first loaded Manpages-dev first
When you execute man LS, the result is the same as the man 1 ls, because LS has only one entry in the man manual.
When you want to see the chmod Call of the hand album, you have to specify the man 2 chmod ~ ~ because chmod has more than one entrance
In man, you can move up and down through j,k (similar to VI), through/query, through N,n find Next, last match (similar to VI)
Q exit (also similar to VI ...)
More interesting:
Since man is an order, he can be =.=.

Create a Directory
Most commonly used parameters:
-p--If the parent directory does not exist in the given path, the parent directory is created at the same time

Mount :
Mount the file system (which can be understood as mounting a partition)
most common parameters:
-t       --Specify file system type , such as iso9660 (Mount ISO image as CD-ROM, equivalent to virtual CD-ROM), ntfs,ext3,rfs and so on
-l       --list all mounted file systems, support volume label
-a       --mount all partitions recorded in the Fstab
-n       -- When mounting, do not write/etc/mtab
-o       --is a fairly common parameter, specifying the "option" to mount the file system, such as Noatime, which is suitable for mounting a BT dedicated partition
MV :
Move or rename the file, depending on whether the destination directory is the current directory
most commonly used parameters:
-b       -- Make a backup of each existing destination file (to prevent overwriting)
-f       --does not prompt for overwriting a destination file that already exists
-i       --the inverse of the-f argument
-u       --move only if the source file is newer than the destination file or the destination file does not exist
-v        --shows the progress of moving a file (this parameter is always recommended for individuals to understand what you are doing)

Lists the execution status of the current command, PS is static, top is dynamic (top ' Q ' exits)
PS: This command is more commonly used, I recommend you to see =.=
Most common parameters (PS multi-use parameter collection, not a single parameter, and used with grep)
-ef--Lists all current process states in standard syntax, such as Ps-ef | grep Eva #列出eva的进程状态
aux--is listed in the BSD syntax ......... .................
-ejh--List Process Tree
-elf--simultaneous status of outgoing threads

RM, RmDir:
RM: Delete a file or directory, RmDir: Delete an empty directory (this command personally think that no use, can be replaced by rm-r)
RM most commonly used parameters:
-f--do not prompt for files that do not exist, skip directly
-i--each delete action prompt (=.= delete more words is not bored to death)
-i--Delete multiple files (more than 3) or recursively delete (for non-empty directories) prompt once
-R and-r--recursively delete everything in this directory
-v--Displays the deletion action for each file (this parameter is always recommended by the individual and what you are doing)

This is probably the first command to be used after the system is installed, right?
Sudo we are mainly used to temporarily elevate the permissions, mainly for the administrator (super User) permissions to run the command, when the need to modify the current login user force cannot and the file/directory
sudo, or su-c, of course, the scope of Sudo and Su is not only so
You can use Visudo to edit the/etc/sudoers file to modify sudo more detailed actions (such as remembering the password timestamp length), please modify it carefully!

Interpreting execution at the terminal
Similar to the './' form, but PT gives a different point: './' is only valid for programs with execute permission in the current directory, ' sh ' regardless of this set
Think about it too, './' just give the path to a file (in the current directory), but this file can be executed is not good to say
So it's always right to use sh

Shut down the system, if you stay in the TTY, use Halt, Poweroff and other commands
Common parameters:
+m--Specifies the minutes of shutdown delay
-c--cancel a request to shut down (turn off the terminal that is running this command also:))
now--immediately shut down the machine
hh:mm--manually specified time (in 24-hour meter)

This tar doesn't say much. There's tar.gz,tar.bz2 all over the place.
Like the PS command, tar generally does not use a single parameter, but a combination of multiple parameters, remembering that parameter x is decompression (extract), and C is the creation of a package (creat).
Most commonly used parameters:
-xvf--detailed listing of unpacking steps
-cvf--detailed list of packaged steps
-j--is used to indicate that this is a tar.bz2 package, such as TAR-XJVF myfile.tar.bz2
-t--list of files in a package
--Package parameters that are always appended:
-r--append to the compressed package
-u--only appends files that are newer than the package.
-h--does not add symbolic links to the package, but instead adds the file to which this symbolic link points
Additional instructions: Tar is a very powerful thing, the common operation is to pack unpacking, advanced features or see Man =.=

Change the file timestamp by default including modify time and creation time, default to current time, default if file does not exist, create new

I. Common commands for 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.