A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service
Transferred from: http://blog.csdn.net/simongeek/article/details/45271089
(i) Ubuntu basic command One
1. Help Man
--help simple help such as: Man tar or tar--help
Help command in more detail
Man command for the most detailed help
2. ls command
Ls-a Show all files and folders, including hidden files or folders
LS-L displays a full range of file information, including permissions, users, user groups, and more.
The LS--color displays files and folders, and is labeled with different colors.
3. Tab key
The tab command is used when your command is not complete, enter one and click to complete the completion, if there are multiple previous parts of the same command, then
Press the TAB key two times
Alias ubuntu= "LS" is used to alias a command. When you enter Ubuntu it is equivalent to entering the LS command.
(ii) Ubuntu basic commands two
The which command is used to find the directory where the command file you are executing resides.
The current user's operating environment.
Echo $PSTH See what the path to the environment variable is, and the which command uses it to look up the command file in the directory of the environment variable
The directory that is stored, from front to back.
The cmp/bin/ls/bin/dir is used to compare whether two files are identical.
CP/BIN/LS/BIN/A the command used to copy the file. Then you copy a command file and you can run the a command, which is the same as the LS usage.
The preceding D indicates a folder, if-Indicates a file.
RWX indicates that the file owner has read and write execution permissions
R-x represents the permission read execution of the group where the file owner resides
R-x indicates that other people have permission to read execution.
Used to change the user's permissions for the file operation. chmod 0+r to add Read permissions. sudo chmod 0-r filename cancels the Read permission.
Used to display and set advanced properties for user files and directories.
Used to list the USB devices in the computer.
Used to list the PCI devices in the computer.
There are two types of drivers under Linux. One is loaded into the kernel, and the other is in the form of modularity. Lsmod is used to
Lists the driver modules inside the computer.
(c) Ubuntu Basic command Three
The cat command is the command used to view the contents of the Ubuntu Chinese text file.
The cat/proc/cpuinfo is used to view the computer's CPU information.
Cat/proc/meminfo is used to view the internal information of a computer.
Cat/etc/issue View version information for Ubuntu.
The free command is also used to view the intrinsic information in the Ubuntu computer.
The grep command in Ubuntu is used to filter out information that is useful to you in a file.
Cat/proc/meminfo |grep Memtotal is used to filter out the memory size in memory.
The more command in Uubntu is used to display the results in pagination. Ls-a |more for pagination display.
The commands for viewing hard disk information in Ubuntu are in Fdisk.
The command to view the kernel version in Ubuntu is uname-a, and only input uname will output Linux as a result.
(iv) file Operation command:
Format: LS directory
The LS command is used to display which files are under the file.
Format: Touch test1 test2 test3
The touch command is used to create files, and you can create multiple files at the same time.
Format: RM file
The RM command is used to delete files, and when the file cannot be deleted, you can add the-F option to force the file to be deleted.
The cat command is used to view information within a file. If you want to view only one item, add the grep option.
Example: Cat/proc/meminfo |grep memtotal
The less command is also a command to view the contents of a file, but he displays it as a screen-by-screen display.
A, press the space bar to enter the next screen.
B. You can also move rows up or down by using the up and down keys.
C, press the Q key to exit the view.
The more command, like the less command, is used to view the contents of a file, as well as a split-screen display.
A, press the space bar to enter the next screen
b, press the Q key to exit the view
The CP is a copy abbreviation for copying files.
The MV command is used to move files.
Format: sudo find/-name ls
The Find command is used to find files:
A,/= The starting directory of the lookup,
B,-name with this option, show only the results that are found in the display.
C, LS is the directory file you are looking for.
(v) directory Operations Command:
Format: mkdir home/user1/f1
The mkdir command is used to create a directory.
A, home/user1/this is a directory, which can be either an absolute path or a relative path.
b, if you can create multiple files in the current directory. such as: MkDir F2 F3 f4
Format: RM-RF test/f2 test/f3
The RM command is used to delete the same as the action file.
A,-RF has r can delete the directory and its subdirectories, F is used to forcibly delete.
B, Test/f2 test/f3 is to delete multiple files at the same time.
The PWD command is used to indicate where the current path is. is the abbreviation for print working directory.
The CD command is used to change the current directory.
A.. Represents a return to the parent directory. Represents the current directory.
B,-represents the directory that was used to go back to the previous time.
Format: LS directory name
The LS command is used to see what subdirectories and files are in the directory.
Format: Cp-r source directory name Destination directory name
The CP command is used to replicate the same as the action file, with R indicating that its subdirectories are copied together.
Format: MV Source directory name destination directory name
The MV command is used to move the same as the action file, when the source directory and the destination directory are renamed under the same parent directory.
Format: Find start directory-name The directory you are looking for
The Find command is used to find the same as the action file.
I. File/folder Management
LS lists the current directory file (excluding hidden files)
Ls-a list current directory files (including hidden files)
Ls-l list the files in the current directory for more information
Cd.. Back to the top-level directory of the current directory
CD-Back to the same directory
CD ~ or CD back to the current user's host directory
mkdir directory name Create a directory
RmDir Empty directory name Delete an empty directory
RM FileName File name Delete a file or multiple files
RM-RF non-empty directory name delete everything under a non-empty directory
MV Path/Document/warp/file movement relative to the path of the file to the absolute path
MV FileName New name renamed in current directory
Find Road via-name "string" finds paths in the range of files and directories that meet string matches such as: Find-name "Test"
Second, System management
Fdisk fdisk-l View system partition information such as: Fdisk fdisk-d: View D-Disk partitioning
Uname-a Viewing the kernel version
Cat/etc/issue View Ubuntu version
Cat/proc/cpuinfo Viewing CPU information
LSHW Viewing current hardware information
sudo fdisk-l viewing disk information
Df-h viewing the remaining space on the hard disk
Free-m View Current Memory usage
PS-A See which processes are currently in progress
Kill process Number (the number of the first column in ps-a) or killall process name (kills a process)
Kill-9 process number forces a process to be killed
TAR-C Create Package –x release Package-v Display command procedure –z represents a compressed package
TAR–CVF benet.tar/home/benet Pack The/home/benet directory
TAR–ZCVF BENET.TAR.GZ/MNT Package and compress the directory
TAR–ZXVF benet.tar.gz Compressed Package file decompression and recovery
TAR–JXVF benet.tar.bz2 Decompression
Iv. make compilation
Make install installs the compiled source package
Five, Apt command
Apt-cache Search Package
Apt-cache Show package for information about packages, such as description, size, version, etc.
sudo apt-get install package
sudo apt-get Install package--Reinstall reinstall packages
sudo apt-get-f install fix "-F =–fix-missing"
sudo apt-get Remove Package
sudo apt-get Remove Package--purge delete packages, including deletion of configuration files, etc.
sudo apt-get update source
sudo apt-get upgrade update installed packages
sudo apt-get Dist-upgrade upgrade system
sudo apt-get dselect-upgrade using Dselect upgrade
Apt-cache depends package learn about using dependencies
Apt-cache Rdepends package is to see which packages are dependent on
sudo apt-get BUILD-DEP Package Installation-related compilation environment
Apt-get Source Package Downloads The source code for the bundle
sudo apt-get clean && sudo apt-get autoclean cleanup of useless packages
sudo apt-get check to see if there is a corrupted dependency
sudo apt-get clean cleans up all software caches (that is, the Deb packets that are cached in the/var/cache/apt/archives directory)
view software XXX installation content
#apt-cache Search Regular Expressions
Find out which package the file belongs to
#dpkg-s filename apt-file search filename
Query software xxx depends on which packages
#apt-cache depends xxx
Query software xxx by which packages depend
#apt-cache rdepends xxx
Add a disc source
#sudo apt-cdrom Add
#sudo apt-get Update
#sudo Apt-get Upgrade
#sudo Apt-get Dist-upgrade
Automatic processing of H files is missing at compile time
#sudo auto-apt run./configure
To view the temporary storage directory for downloading packages when installing software
To back up a list of all packages that are currently installed on the system
#dpkg –get-selections | Grep-v deinstall > ~/somefile
Recover all packages from the list file of the installed packages backed up above
#dpkg –set-selections < ~/somefile sudo dselect
Clean up older versions of the software cache
#sudo Apt-get AutoClean
Clean up all software caches
#sudo Apt-get Clean
Remove orphaned software that is no longer used by the system
#sudo Apt-get Autoremove
View the address of the package on the server
#apt-get-qq–print-uris Install SSH | Cut-d\ '-f2
"Go" linux-ubuntu common Command Summary
Start building with 50+ products and up to 12 months usage for Elastic Compute Service