Summary of common ubuntu commands

Source: Internet
Author: User
During this time, I learned about the ubutun system. one feature of linux is that many operations can be processed through terminal commands. Once familiar with it, the processing efficiency is very high, but the skill and learning costs are relatively high. To sum up the following common commands: I classify common commands into four categories: file management command file operation addition & mdash; t...

During this time, I learned about the ubutun system. one feature of linux is that many operations can be processed through terminal commands. Once familiar with it, the processing efficiency is very high, but the skill and learning costs are relatively high. The common commands are as follows:
I divide common commands into four types:

File management commands

File operations
Add -- touch filename to create a new file
Delete -- rm file name
Query -- find the file name and directly search for it in the hard disk.
Partially match the locate file name
Whereis file names are retrieved from the linux File database (/var/lib/slocate. db ).
Comparison -- diff file1 file2 compares the differences between the two files
Move-absolute path file of mv relative path
Rename-new name of the original mv file name
Copy -- cp/path/file./copy the file in the absolute path to the current path

File Directory
View -- pwd view current path
Create -- mkdir directory name
-P: if the parent directory does not exist in the given path, the parent directory is created at the same time.
Delete -- rm directory name-r (rmdir: delete an empty directory. (This command is useless and can be replaced by rm-r ))
-F-skip without prompting for a nonexistent file
-I-a message is displayed for each delete action.
-R and R-delete all
-V-display the delete action of each file (recommended)
Switch -- cd path-switch to the corresponding path
Cd...-back to the upper-level Directory
Cd ~ -Switch to the home directory.

File permission
View permissions -- ls-l
For example, (-rwxr-xr --) r: read w: write x: Execute
Rwx: indicates the permission binary representation of the file owner: 111 = 7
R-x: indicates other user permissions in the same group. binary representation: 101 = 5
R --: indicates the permission of other users in binary format: 100 = 4
The permission can be expressed as: 754

Change permission -- chmod permission file name
Chmod 777 a.txt = chmod a + rwx a.txt
The chmod u-w file grants the current user the write permission.
Chmod g + r file: add read permission to the file Group
Chmod o + w file adds write permission to other users of file
Chmod a-x file: all users of the file minus the execution permission.

Chown root/home: change the owner of/home to the root user.
Change the/home group to the root group for chgrp root/home.

File display
List Display -- ls
-Lh: displays detailed information about the file.
-S: Display file size
View content -- the cat file name displays all the content of the file on one screen
-- More File name: View file content by page
-- Less file name can be viewed by page
-- The header file name displays the start part of the file.
-- The tail file name displays the end of the file.

Software Management commands

Software Installation
Install packagename online -- sudo apt-get install packagename
Sudo apt-get remove packagename uninstall packagename
Sudo apt-get update software package

Offline installation-download the software package (decompress)
Tar [-cxtzjvfpPN] file and directory...
-C create package-x release package-t view the file in the package
-V: Display the command process z-compressed package f-file name
Tar-zcvf abc.tar/mydoc/a. iso package the/mydoc/a. iso Directory
Files in tar-ztvf abc.tar abc.tar
Tar-zxvf abc.tar decompress the abc.tar package to the current directory

Compile and install --./configure -- prefix =/usr/local/pre-compilation configuration
Make compilation
Make install the compiled source code package

View installation
Check whether the software is installed-dpkg-l | grep software name
Software installation location-type software name

User management commands
View -- id
Add -- Useradd to create a new user
Groupadd create a new group
Modify -- Usermod modify user account
Usermod-l old username
Delete -- Userdel-r user name delete all user information
Password-passwd
Passwd-S query account status


System management commands

Operation
View the system running level -- runlevel
Shutdown -- shutdown-h now/Halt init 0
Restart -- reboot/init 6
Environment variable -- env
Echo $ path
Set
Process
View system processes-top dynamic ps-aux static pstree process tree
Scheduling -- fg transfers the background process back to the foreground
Bg
Terminate -- kill PID to terminate a pid process
Timing -- at 5 pm + 3 days/bin/ls specify to execute/bin/ls at pm three days later
Automatic periodic task-crontab
-E: use VI to edit automatic periodic tasks
Service crond Enable automatic periodic service immediately
Network
Ifconfig --
Ifconfig eth1 192.168.1.10 netmask 255.255.255.0 // Set the Nic subnet and ip address

Disk
View --
Total capacity remaining of the df report file system
Du-B/home view the current/HOME directory Capacity (k) and sub-directory Capacity (k)
Fdisk-l View system partition information
Configuration --
Fdisk/dev/sdb is partitioned by a new SCSI hard disk.
Mkfs. ext3/dev/sdb1 is the file system formatted as ext3 in the first primary partition of the first SCSI hard disk.

Due to the wide variety of linux command parameters, it is impossible to remember the functions of various parameters. Fortunately, we can use "man + command name" to view the parameters and functions of various commands. We are familiar with common instructions, which will greatly improve our efficiency!


Author: "My IT World"

Related Article

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.