In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Learn the necessary commands of Linux (1) 1: what is Linux
The Linux command is a command that manages the Linux system. For the Linux system, no matter the CPU, memory, disk drive, keyboard, mouse, or users are all files, the command managed by the Linux system is the core of its normal operation. There are two types of Linux commands on the system: the built-in shell command and the Linux command.
in the Linux operating system, it is important to note that linux commands (including file names, etc.) are case-sensitive, and if you enter the wrong command case, the system will not respond as you expect.
II: Linux command line format 1. General command line format
Command word [option] [parameter]
Option
Short format options: use the "-" symbol to guide multiple single-character options that can be combined (e.g. ls-l ls-al)
Long format command option: use the "- -" symbol to boot (for example:-- help).
Parameters.
Processing object of command word
It can be file name, directory name, user name, etc.
The number can be zero to more.
[root@localhost] # means:
root: currently logged in system user
@: delimiter
localhost: hostnam
~: current directory location
# key: indicates administrator
$: ordinary user
2. Edit the Linux command line
Tab key: automatic completion
Backslash "\": force line feeds
Shortcut key Ctrl+U: clear to the beginning of the line u
Shortcut key Ctrl+K: clear to the end of the line
Shortcut key Ctrl+L: clear the screen
Shortcut key Ctrl+C: cancel editing this command
3. Ways to get help from commands
Internal commands help: view help information for Bash internal commands
-- help: for most external commands
Use the man command to read the manual: scroll the text using the up and down arrow keys
turns the page using the Page Up and Page Down keys
press Q or key to exit the reading environment and press "/" to find the content.
Third: common directory / file operation command 1, switch working directory cd
Cd. Switch to the target location
Cd ~ if you do not specify the target location, switch to the host directory of the current user
Cd-change to the directory where the last cd command was executed
Cd.. View the previous directory
Cd../../ check the upper directory.
Cd / root directory
2. Display directory list command ls
Ls-l displays the details of the file
Ls-a view hidden files
Ls-A looks at hidden files except..
Ls-d displays the information of this directory
Ls-h friendly form to display information with units
Ls-R reverse display (if there is a subdirectory, the subdirectory files will be shown in turn)
Pwd displays the user's current working directory
3. Distinguish file types by color
Blue-directories, folders red-compressed package green-executable files / command files / scripts
Sky blue-soft connection file / shortcut file huang color-device file / disk file black / white-data file
4. Statistical catalogue and file space occupancy du
Du [option] [file or directory]
-a count all files when disk space is occupied
-h displays statistical results (kB count by default)
-s only counts the total size of the space occupied, not the size of each subdirectory file
For example: du-sh / var/log/ statistics the total amount of space occupied by var/log files
5. Mkdir for directory creation
For example: mkdir test creates a test directory under the current directory
mkdir-p / aa/bb/cc creates a subdirectory bb under the directory aa,aa and cc under the BB subdirectory
6. File creation (touch) and deletion (rm)
Touch test.txt creates a test.txt file in the current directory
Touch demo {1... 10} .txt creates multiple new empty files
Rm-f test.txt directly deletes the text.txt file
Rm-r recursive deletion, that is, delete directories and subdirectories under their directories
Rm-rf directly deletes directories and subdirectories under their directories
7. Copy a file or directory cp
-f overwrite the target file with the same name without reminding, copy and paste directly
-I overwrite the target file with the same name and remind the user to confirm
-p keep the permissions of the source file when copying, and the attributes remain unchanged
-r must use this option when copying a directory, which means that all files are copied recursively
8. Find a data file or directory find
Find by file name-name
Find by file size-size
Find by file owner-user
Find by file type-type
File types: normal file (f), directory (d), block device file (b), character device file (c)
9. View the contents of the file
Cat displays the contents of the file from the first line
More displays the contents of a file page by page, which is used to display the file contents in full-screen paging mode.
Less is similar to more, but better than more, it extends more functions.
Head looks at the beginning of the file (default is 10 lines) example: head-n file name (n represents the number of lines)
Tail looks at a small portion of the end of the file
10. Wc of statistical file content
Information such as the number of words in a statistical file
-l count the number of rows
-w count the number of words
-c Statistics Bytes
Differences between wc and du:
wc: how many statistics are made?
du: size of statistical files
11. File filing command tar
-C: create a compressed package-x: extract-f: execute-v: display the detailed process-p: retain the original file permissions
-t: view compressed content-C: unzipped path-Z:gzip format-j:bzip2 format
Compression commands: gzip, bzip2
-Q: high compression ratio-d: unzip the compressed file
12. Three working modes of vim editor
A: represents the insertion after the cursor
I: represents the insertion before the cursor
O: insert on the next line of the cursor
O: insert on the previous line of the cursor
Basic operation of command mode:
Home key or ^, the number 0: jump to the beginning of the file End key or $: jump to the end of the line 1G or gg: jump to the first line of the file
G: jump to the last line of the file # G: jump to line # of the file
Set nu displays the line number in the editor
: set nonu cancels line number
: set nu! Cancel the line number
13. The meaning of Linux startup level init0-6
Init 0: shutdown
Init 1: single user mode (only root for maintenance)
Init 2: multi-user mode without web character interface
Init 3: full multi-user mode with web character interface
Init 4: safe mode (reserved)
Init 5: multi-user mode graphical interface
Init 6: restart (reboot)
There are many commands to learn linux, you have to memorize and practice more to not forget, but also to understand the meaning of each command representative, you will know what you need to configure.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.