Linux Common commands

Source: Internet
Author: User
Tags set time

To use Linux efficiently, Linux commands are essential, and there are many common Linux commands that must be mastered.

One, date and time

1,date Viewing and setting the date and time of the system
2,-u, to see UTC time (GMT)
3,date +%y--%m--%d where "--" can customize the change, which is the display format for changing the time
4,date-s set time, this need to be cut to the root user to have permission to change
5,date Look at the operating system time, he is from the hardware time, you can directly use Clock (HCLCOK) to view
6,cal to print a calendar
7,uptime, used to see how long the system has been running, the system's users, the system's load
Note: You can use man uptime to see the explanation of uptime.

Two, output, view command
1,echo: Show What you've entered, and what you're going to lose.
2,cat: To display the contents of the file, it directly shows the contents of all the files, very impersonal, troublesome
3, for the convenience of viewing, to avoid the inconvenience of cat, you can use the following several commands
4,more: Used to flip the display, but not page down
5,less: Can page up and down relative to more
6,head: Display the first few lines of a file (default 10 lines)
-N: To specify the nth line at the beginning of the display
7,tail: Display a few lines at the end (default 10 rows)
-N: To specify the n rows at the end of the display
- F: Tracking display file updates, when we use the-F directive, the command line will be stuck here, waiting for the file to be updated to show new content. Generally used to view the log, continuously display the newly added content

Third, view hardware information
1,LSPCI for viewing PCI devices (such as sound card cards, etc.)
- v View more information
These commands are pretty much the same as the Windows Midpoint attribute point Device Manager
2,LSUSB viewing USB devices, such as cameras, etc.
- v also displays details
3,lsmod View all currently loaded modules (modules that are equivalent to drivers in Windows)

Four, shutdown restart
format: Shutdown "shutdown/restart" Time
shutdown Now: shutdown-h Now=poweroff
Restart now: Shutdown-r now=reboot
n minutes after the shutdown: shutdown-h +n
Timer shutdown: shutdown-h xx:xx

Five, archive and compress
1,zip to compress: Zip xxx.zip file (compress file as Xxx.zip is target file)
2,unzip Xxx.zip is the unzip file
3,gzip: Also a compression method
4,tar: An archive command that packs many files into a single file
-CVF Out.tar liunxfile: The file in the Linuxfile folder is archived into an output Out.tar format file that can be used for backup, but he does not compress oh
-CVF Out.tar release an archived tar file to the current file
-CVZF: A z command is added under the CVF command, which is to archive and compress a file. A gzip command is called here
format: Tar-cvzf xxx.tar.gz/the directory to save
In fact, the most used is to archive and compress the command
Decompression: TAR-ZXVF FileName.tar.gz

Compression: TAR-ZCVF FileName.tar.gz DirName


Six. Find commands (Find files, folders)
find files in our operating system
1,lacate keyword Quick Find
It requires a pre-established database, such as when you create a new file, and then use locate to find the command, which is not found (the database is updated once a day). At this point you can use the "updatedb" command to update the database first, and then find it.
2,find supports many search criteria, so called Advanced Find
format: Find find location lookup parameters
find.-name*linuxcast* "." Indicates that the current folder * represents 0 or more characters-name represents the name of the lookup file, folder
*xxx* represents a keyword that represents all files that contain the "linuxcast" keyword under the current folder
Find/-name *.conf finds all files with the end of. conf under the/root partition
Find/-perm 777 finds all files on the hard drive that are 777

Find/-type D finds the directory type file. D means the directory, or L, to find all the connections

Find can also use the results of a lookup to execute some commands.

find.-name "A *"-exec ls-l {} \;

This sentence means finding all files that begin with "a" and then sending it to the "ls-l" command to execute, showing the details.

where {} \; is a fixed format.

-exec is also a fixed format, meaning of execution;

find has a number of suffix parameters that can be found directly in the network or help file



Linux Common commands

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.