In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces "the brief introduction of Linux and the use of basic commands". In daily operation, I believe many people have doubts about the brief introduction of Linux and the use of basic commands. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts of "brief introduction of Linux and the use of basic commands". Next, please follow the editor to study!
A brief introduction to Linux
Linux Command Foundation
Linux Command help
Basic operation of directory and file
Linux family
Redhat Red Hat three certifications (open source but not free)-"Community (system developer) -" Centos (server side)
Ubuntu's best client system, open source and pure free (software developers)
Debian-"kali Linux (special tools take up very little resources) raspberry pie
Suse Linux--- "ISP (Telecom, Mobile, Unicom) customized version
A Special Program of shell--Linux system-- "translator"
A shell program is automatically loaded when the user logs in to the Linux system. Bash is the shell program used by default in the Linux system.
The kernel of Linux is developed by C language (process-oriented language), and applications are developed in C++.
Compiler-- gcc gcc-c++ jdk (compiler of Java) the compiler of Python is Python2/3
Source file-"(compiler) -" execution file
Classification of Linux commands
Internal command
External command
The common command line uses the format:
Command word [option] [parameter] (corresponding to operation, function, operation object)
-A combination of individual characters
-- words
Introduction to root@localhost ~] #
Root-current user
@-- delimiter
Localhost-- Host name
~-- current directory location
#-Administrator
$--ordinary user
Introduction to the path
Absolute path: for example-- / etc/sysconfig/network-scripts/
Relative path (path to current location): for example-- sysconfig/
Home directory: administrator (/ root) ordinary user (/ home)
Root directory: /
II. Linux command set (combined with examples)
Cd: switch working directory
Pwd: view the absolute directory path where you are currently located
[root@lokott ~] # cd / etc/sysconfig/network-scripts/ enter the folder under the absolute path [root@lokott network-scripts] # pwd / / display the absolute path of the current directory / etc/sysconfig/network-scripts [root@lokott network-scripts] # cd-/ / return the last directory entered command Namely cd / etc/sysconfig/network-scripts//root [root@lokott ~] # cd-/ etc/sysconfig/network-scripts [root@lokott network-scripts] # cd.. / / return to the upper directory [root@lokott sysconfig] # cd.. /.. / / return to the upper two-tier directory [root@lokott /] #
Ls: displays the contents of the current directory
-l display file details
-a view hidden files
-A check except. .. Hidden file of
-d display the information of this directory
-h friendly form to display information with units
-R recursive display
-- color distinguishes file types by color
Black (data file)
Blue (catalog)
Red (compressed package)
Green (execute file / command file / script)
Sky blue (linked file)
Yellow (device file / disk file)
[root@lokott ~] # lsanaconda-ks.cfg initial-setup-ks.cfg note shell Public template Video Picture document download Music Desktop [root@lokott] # cd shell/ [root@lokott shell] # ls 1.sh 2.sh 3.sh 4.sh 5.sh 6.sh hello [root@lokott shell] # ls-a. .. 1.sh 2.sh 3.sh 4.sh 5.sh 6.sh hello [root@lokott shell] # ls-A1.sh 2.sh 3.sh 4.sh 5.sh 6.sh hello [root@lokott shell] # ls-l total dosage 24-rwxr-xr-x. 1 root root 111October 25 19:10 1.sh-rwxr-xr-x. 1 root root 124 October 25 19:12 2.sh-rwxr-xr-x. 1 root root 192 October 25 19:25 3.sh-rwxr-xr-x. 1 root root 104 October 25 19:33 4.sh-rwxr-xr-x. 1 root root 147October 25 19:36 5.sh-rwxr-xr-x. 1 root root 26 October 25 19:37 6.shdrwxr-xr-x. 2 root root 18 October 30 13:53 hello [root@lokott shell] # ls-R.:1.sh 2.sh 3.sh 4.sh 5.sh 6.sh hello./hello:0.sh [root@lokott shell] # ls-d. [root@lokott shell] # ls-ah. .. 1.sh 2.sh 3.sh 4.sh 5.sh 6.sh hello [root@lokott shell] # ls-lR.: total dosage 24-rwxr-xr-x. 1 root root 111October 25 19:10 1.sh-rwxr-xr-x. 1 root root 124 October 25 19:12 2.sh-rwxr-xr-x. 1 root root 192 October 25 19:25 3.sh-rwxr-xr-x. 1 root root 104 October 25 19:33 4.sh-rwxr-xr-x. 1 root root 147October 25 19:36 5.sh-rwxr-xr-x. 1 root root 26 October 25 19:37 6.shdrwxr-xr-x. 2 root root 18 October 30 13:53 hello./hello: total dosage 0-rwxrwxrwx. 1 root root 0 October 30 13:53 0.sh [root@lokott shell] #
Alias: give the command an alias
Du: statistics of directory and file space occupancy
-a
-h friendly display
S
Which: find the command storage directory
The search scope is determined by the environment variable PATH
Mkdir: create a directory
-p Recursive nested creation
Touch: creating fil
[root@lokott shell] # alias cantilever clear` / / clear means that clearing the screen is equivalent to Ctrl+l [root@lokott shell] # which c alias cantilever clear` / usr/bin/clear [root@lokott shell] # which clear/usr/bin/clear [root@lokott shell] # mkdir linux [root@lokott shell] # ls1.sh 2.sh 3.sh 4.sh 5.sh 6.sh hello linux [root@lokott shell] # touch 0.sh [root@lokott shell] # ls0.sh 1.sh 2.sh 3.sh 4.sh 5.sh 6.sh hello linux [root@lokott shell] # du-ah4.0K. / 1.sh4.0K. / 2.sh4.0K. / 3.sh4.0K. / 4.sh4.0K. / 6.sh0. / hello/0.sh0. / hello0. / linux0. / 0.sh24K. [root@lokott shell] # du- Sh24K. [root@lokott shell] # du-as / / cannot set the option to-as (h) du: cannot both display the total dosage At the same time, it also displays each project Try'du-- help' for more information. [root@lokott shell] # [root@lokott shell] # mkdir-p / 20119 touch 2017 / / create a folder [root@lokott shell] # cd / 20119 touch 2017 / [root@lokott 2017] # touch {1.. 10} .t xt / /.. Means to create 10 consecutive txt files named 1-10 [root@lokott 2017] # ls10.txt 1.txt 2.txt 3.txt 4.txt 5.txt 6.txt 7.txt 8.txt 9.txt
The file node (inode value) appears during the following operation: the identification sequence that the file stores on disk.
Ln: create a linked file (a shortcut similar to a Windows system)
Soft links: equivalent to shortcuts-s
Hard links: aliasing files (hard link folder cannot be created)
[root@lokott shell] # ln-s 1.sh 8.sh [root@lokott shell] # ln 1.sh 10.sh [root@lokott shell] # ls-l Total dosage 28-rwxrwxrwx. 1 root root 0 October 30 13:59 0.sh-rwxr-xr-x. 2 root root 111October 25 19:10 10.sh / / hard link-rwxr-xr-x. 2 root root 111October 25 19:10 1.sh-rwxr-xr-x. 1 root root 124 October 25 19:12 2.sh-rwxr-xr-x. 1 root root 192 October 25 19:25 3.sh-rwxr-xr-x. 1 root root 104 October 25 19:33 4.sh-rwxr-xr-x. 1 root root 147October 25 19:36 5.sh-rwxr-xr-x. 1 root root 26 October 25 19:37 6.shlrwxrwxrwx. 1 root root 4 October 30 14:07 8.sh-> 1.sh / / soft link drwxr-xr-x. 2 root root 18 October 30 13:53 hellodrwxr-xr-x. 2 root root 6 October 30 13:59 linux [root@lokott shell] # ls-ih / / displays the size of the file node value 19397655 0.sh 20564913 10.sh 20564913 1.sh 20564915 2.sh 20564917 3.sh 20564916 4.sh 20564918 5.sh 20564919 6.sh 19134334 8.sh 20565286 hello 35183604 linux// above the file is the file node (inode value) the soft link is inconsistent with the file node of the source file The hard-linked file node is consistent with the source file.
Cp: copy file or directory source | destination
-f do not ask
-I asked whether to overwrite the original
-p keep the user rights of the source file unchanged and be used by users with high permissions
-r recursive replication
Rm: deletin
-I: default reminder
-rf: force recursive deletion
Mv: move files or directories
[root@lokott shell] # cd hello/ [root@lokott hello] # ls0.sh [root@lokott hello] # cp.. / 5.sh. [root@lokott hello] # ls0.sh 5.sh [root@lokott hello] # cp-I. / 5.sh .cp: is ". / 5.sh" overwritten? Yes [root@lokott hello] # cp-f.. / 5.sh. / / guess has been alias cp: whether to overwrite ". / 5.sh"? Y [root@lokott hello] # [root@lokott hello] # which cp / / View the cp command has been changed by alias alias cp='cp-i' / usr/bin/cp [root@lokott hello] # cp-r.. / linux/. / / Recursively copy all contents of the upper path linux folder to the current path (currently no content) [root@lokott hello] # ls0.sh 5.sh linux [root@lokott hello] # cd linux/ [root@lokott linux] # ls [root@lokott linux] # mkdir 2020 / / create folder [root@lokott linux] # ls2020 [root@lokott linux] # cd 2020 / [root@lokott 2020] # touch 2.txt / / create File [root@lokott 2020] # cd. /.. / [root@lokott hello] # ls0.sh 5.sh linux [root@lokott hello] # mv linux/.. / / Mobile folder mv: overwrite ".. / linux"? Y [root@lokott hello] # cd. [root@lokott shell] # ls0.sh 10.sh 1.sh 2.sh 3.sh 4.sh 5.sh 6.sh 8.sh hello linux [root@lokott shell] # ls-l linux/ Total amount 0drwxr-xr-x. 2 root root 19 October 30 14:15 2020 [root@lokott shell] # cp-r linux/ hello/ Recursively copy all the contents of the linux folder to the hello folder [root@lokott shell] # cd hello/ [root@lokott hello] # ls0.sh 5.sh linux [root@lokott hello] # ls-l linux/ Total usage 0drwxr-xr-x. 2 root root 19 October 30 14:16 2020 [root@lokott hello] # ls-lR linux/ Recursively view the copied folder information linux/: total usage 0drwxr-xr-x. 2 root root 19 October 30 14:16 2020linux/2020: the total dosage is 0murr RWMI. 1 root root 0 October 30 14:16 2.txt
Wildcard character
? Represents a
* indicates multiple
Find: find a file or directory
Find [look in] [option] [expression]
-name: search based on the target name
-type: find by file type
-size: search by size
-user: find based on the user owner of the file
[root@lokott hello] # find. -name "* .sh" / / * denotes the wildcard. / 0.sh./5.sh [root@lokott hello] # find. -type f./0.sh./5.sh./linux/2020/2.txt [root@lokott hello] # find. -size-10k../0.sh./5.sh./linux./linux/2020./linux/2020/2.txt./ifcfg-ens33 [root@lokott hello] # find. -size-10k | du-ah0. / 0.sh4.0K. / 5.sh0. / linux/2020/2.txt0. / linux/20200. / linux4.0K. / ifcfg-ens338.0K. Centos7 command listing 1. Init 0 shutdown 2. Init 1 single user mode (system maintenance Break password) 3. Init 2 multi-user mode no network 4. Init 3 multi-user mode has network * 5. Init 4 retains 6. Init 5 multi-user mode graphical interface has network 7. Init 6 restart (reboot) so far, on the "Linux brief introduction and basic command use" study is over, hope to solve everyone's doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
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.