There are many basic commands in Linux that we all know, such as LS,CAT,TOUCH,CP, but even the most basic commands, different parameters have different functions, this afternoon at home no matter the parameters of some basic commands on the virtual machine asked knocked, Think also quite interesting, finishing down, everyone is not good when can send some empty time, O (∩_∩) o haha ~< statement, the following these commands do not have any sort, is I think of where to write, right vote by my wayward one back! Meow ~>1, Shutdown (play the system of course to start from the switch machine)directly below the parameters:
- -T: The number of seconds followed by "shutdown after a few seconds."
- -K do not really shut down, just send a warning message.
- -R restarts after the service of the system is stopped
- -H shuts down the system immediately after the service is stopped
- -N does not go through the INIT program, directly to the shutdown function to shut down the machine
- -F Force the disk check of fsck after shutting down and powering on
- -F Force a disk check for fsck after a system restart
- -C cancels the contents of the shutdown instruction already in progress
******************************************A few chestnuts (*^__^*) hehe ...****************************************** this tells you that the machine will shut down after 10 minutes and will appear in front of the logged-in person's screen. * Note: The time parameter must be added, otherwise shutdown will automatically jump to RUN-LEVEL-1 (single maintenance mode login)! that is, the system will be in today's 8:45 shutdown, if after 8:45 to release this command, then the next day of 8:45 again shutdown. that is, the system will restart in 30 minutes, and display the following message to all online users. If you change the-R to the-K parameter, the system does not actually restart after 30 minutes, but instead frightens the online user! ******************************************In addition, there are several related commands in Linux, which are presented here:reboot (restart), halt (off), Poweroff (power off, add-f parameter used) 2, init (after boot is the system between the level of execution switch)
- init0--system stop, that is, shutdown
- init1--Single user system, no login required
- init2--Multi-user system, but does not support NFS, command-line mode login
- init3--full Multi-user mode, command-line mode login
- init4--is not used (the system is not used, reserved for general use, in some special cases can be used. For example, the laptop battery is almost exhausted, you can switch to this mode to do some configuration. )
- init5--Graphics mode
- init6--Rebooting the system
The above is the Linux seven RunLevel, you can see the comment code in the/etc/initab file, as follows:
* Note: In the rc0.d~rc6.d file under/etc, see the scripting services that are running and killed at different levels of execution. s starts the service, and K begins the service to kill the representative. 3, LS (this command is estimated to talk about vomiting ~)Basic usage:ls [-aadffjilnrrst] Directory namels [--color={auto,never,always}] Directory namels [--full-time] Directory name
Parameters |
Parameter description |
-L |
Long format displays the list under the directory |
-A |
Show all files, including hidden files |
-H |
User-friendly way to display file sizes in the directory |
-I. |
Show file inode number |
-T |
Sort by the time the file or directory was modified |
-R |
Reverse order |
-P |
Add to directory / |
-F |
Labeling different file types |
--color=auto |
Add color display to file |
--full-time |
Lists the complete date and time of the file (that is, contains the year, month, day, hour, minute) |
give me a chestnut:to/root directory files in reverse modification time display, and the time format for the full time mode, modify the file 123.txt and then view 4, BC (Simple and useful calculator)
Careful you may have the same doubts with me, 999/666 the result seems to be wrong? Baidu a bit, this is because BC presets only output integers, if you want to output the number of decimal places, then you have to execute scale=number, that number is the decimal place, for example:
5, Lastlog (see the last login log)
Used to display the most recent logon information for all users in the system. The Lastlog file is queried each time a user logs on. You can use the Lastlog command to check the last logon time for a particular user and format the output of the last logon log/var/log/lastlog. It displays the login name, port number (TTY), and last logon time based on the UID sort. If a user has never logged in, Lastlog displays **never logged**. Note You need to run the command as root.
Parameters |
Parameter description |
- b (days) |
Displays the login information before the specified number of days |
-H |
Display Help information for a call-up order |
- T (days) |
Displays login information since the specified number of days |
- u (user name) |
Displays the most recent login information for the specified user |
6, ln (create a linked file, the default is to create a hard-link file)Create a connection under the same path without an absolute path, you must use absolute path to create a connection under different directories. syntax Format:# LN [-S] source file destination file
Parameters |
Parameter description |
-S |
Create a soft link file |
Chestnut Chestnut: **********************
Create a soft chain for the/root/tina/application/apache2.2.17 directory/apache
7, Sync (data synchronously write to disk)input Sync, the data that has not been updated in memory, will be written to the hard disk, so this command should be performed more than once before the system shuts down or restarts! (roar ~ The important thing will be three times!) )8, locate (with find have a spell ~)The Locate command is not a real-time lookup, so the results of the lookup are inaccurate, but the lookup is fast. Because it does not look for a directory, it is a database (/var/lib/locatedb), which contains all the local file information. the Linux system automatically creates this database and updates it automatically once a day, so you can't find the latest changed files using the Locate command. To avoid this situation, you can manually update the database by using the UpdateDB command before using locate . Syntax Format: # Locate executable file name 9, find (used to locate files in the specified directory) any string that precedes the parameter will be treated as the name of the directory you want to find. If you use this command without setting any parameters, the Find command looks for subdirectories and files under the current directory. and displays all the subdirectories and files that are found. Syntax format: # Find directory path [-type, name, exec, Perm, Inum] file basic parameters:
Options |
Option description |
-type |
File type |
-name |
Filename |
-exec |
Perform actions |
! |
Take counter |
-mtime |
Find by modified time |
-maxdepth |
Find the depth of a directory |
-perm |
Find files with specified number permissions |
-inum |
Locate the file for the specified inode number |
-size |
Finds the specified file size range, can be used multiple times, medium indirect parameter-A or-O, default to-a |
Example Description: ************************
10. File (view files type)
Syntax structure:
# file [-BL] Files
Basic parameters:
Parameters |
Parameter description |
-B |
Only display file types do not display filenames |
-L |
Show the file types that the link points to |
Linux common commands (i)