Linux OS learning records

Source: Internet
Author: User
Linux operating system learning record-general Linux technology-Linux technology and application information. The following is a detailed description. 1. view the kernel version by uname-r.
2. Related to the on/off Server
(1) init n
0 Shutdown
1 to enter Single mode
2. limited network commands, no nfs Function
3. Rich network functions of nfs
4 left for user customization
5 X-windows
6. Restart
In the inittab under/etc, you can set the default startup of the system, which is generally set to 3 or 5, and set to 3 to directly enter
Character Mode. If the value is set to 5, the image mode is directly enabled. The value cannot be set to 0 or 6.

(2) startx enters X-windows in character mode.

(3) halt Shutdown

(4) reboot restart

(5) shutdown
-R restart
-H Shutdown
-K sends a Message to the user
-C. Cancel a shutdown operation.
-F restart does not use fsck
-F restart to force the use of fsck
The time format can be "hh: mm" (a few minutes) or "+ m" (several minutes later). Enter "now" to immediately shut down the instance.

3. Files And Directories
(1) ls viewing Directories
-M: Use commas to separate files and display them in one line.
-F category display file
-L display files in the form of a list (equivalent to the command: ll)
-A: displays all files, including hidden files (some files are hidden before file names in linux)
-- Color: displays different types of files in different colors (generally, this parameter is not required)

(2) clear Screen

(3) view the current path through pwd

(4) switch the cd directory
Enter the cd directory name
Cd/to the root directory
Cd .. go to the upper-level directory
Cd directly press enter to enter the current user's home directory
Cd ~ Username to a user's home directory
For absolute paths and relative paths, "." indicates the current directory, ".." indicates the upper-level directory, and "/" indicates the root directory.
Directory.
(5) create a directory using mkdir
-P can directly generate multi-level Directories

(6) create a file with touch
Update time when an existing file is modified

(7) Move music video files
Mv file dir: Move the file to the directory
Mv file1 file2 when file2 does not exist, rename file1 to file2; When file2 exists, overwrite file2 with the content of file1, and the file name is file2.
-F is not prompted during the operation.

(8) copy a file using cp
Cp file1 file2 when file2 does not exist, copy file1 content to file2; When file2 exists, copy file1 content to overwrite file2 content.
Cp dir1 dir2 copies the previous directory to the next directory (recursive Operation)

(9) Delete the rmdir directory
The rmdir dir directory must be empty before deletion.
-P: Multi-Level directories can be deleted.

(10) rm delete files and directories
-R is deleted recursively.
-F: Force Delete. No prompt is displayed.
-I prompt information

(11) ln link file
Ln file1 file2 creates a hard link from file1 to file2. file2 should not exist. When file1 content is changed later, file2 will change accordingly.
Ln-s file1 file2 creates a soft link from file1 to file2, which is equivalent to a shortcut in WINDOWS.



(12) cat viewing files
-N: view the row number

(13) The head displays the first few lines of the file.
-N rows (10 rows by default)

(14) tail displays the last few lines of the file
-N rows (10 rows by default)

(15) more File Viewing by PAGE

(16) less more powerful File Viewing Methods
PAGEUP and PAGEDOWN are available.
SPACE flip down, B flip up
/Word search for "word" in the file, press n to view down, and press N to view up.

4. Other system commands
(1) view the current date and time by date
-D: set the current date in the format of mm/dd/yyyy or yyyy"
-S sets the current time in the format of "hh: mm: ss"

(2) dmesg View computer hardware information
Cat/proc/cpuinfo

Cat/proc/meminfo
(3) df view the usage of each partition in the file system
-K in KB
-M in MB
-H automatically uses the appropriate unit

(4) du statistics on the space used by subdirectories at all levels
-S: displays the summary size only.

(5) free View of memory and virtual memory size and usage

(6) view the current user in whoami

(7) cal display calendar
-Y: displays the annual calendar
-J: Number of days displayed

(8) w. view which users have logged on to the system

(9) history of input commands in history
! Execute commands in the history

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.