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/02 Report--
III. The directory structure of Linux
Tree directory structure
/ etc administrator home directory / home normal user home directory / command file directory for all bin users / sbin administrator command file directory / boot boot partition (grub boot menu, compressed kernel, etc.) / usr application directory / etc configuration file directory / var variable length file directory (log) / dev device file directory (disk) Optical drive) / tmp temporary file / proc hardware information (CPU memory) / lib service management file (systemctl) View file contents command
Cat [] file name...: view the contents of the file
More [] file name.. Paging the contents of the file in full screen mode
The extended END of the less [] file name.: more command can be found (man less to view, it is not very convenient to demonstrate the effect here)
Head look at the first part of the file (default is 10 lines)
Tail: look at the contents at the end of the file (default is 10 lines)
[root@lokott hello] # cat ifcfg-ens33 TYPE= "Ethernet" PROXY_METHOD= "none" BROWSER_ONLY= "no" BOOTPROTO= "dhcp" DEFROUTE= "yes" IPV4_FAILURE_FATAL= "no" IPV6INIT= "yes" IPV6_AUTOCONF= "IPV6_DEFROUTE=" yes "IPV6_FAILURE_FATAL=" no "IPV6_ADDR_GEN_MODE=" stable-privacy "NAME=" ens33 "UUID=" 0d6ffef5-693f-4d48-88b5-d2e1a66cf9c4 "DEVICE=" ens33 "ONBOOT=" yes "[root@lokott hello] # more ifcfg-ens33 TYPE=" Ethernet "Ethernet METHOD= "none" BROWSER_ONLY= "no" BOOTPROTO= "dhcp" DEFROUTE= "yes" IPV4_FAILURE_FATAL= "no" IPV6INIT= "yes" IPV6_AUTOCONF= "yes" IPV6_DEFROUTE= "yes" IPV6_FAILURE_FATAL= "no" IPV6_ADDR_GEN_MODE= "stable-privacy" NAME= "ens33" UUID= "0d6ffef5-693f-4d48-88b5-d2e1a66cf9c4" DEVICE= ens33 "ONBOOT=" yes "root@lokott hello] # head ifcfg-ens33 TYPE=" Ethernet "PROXY_METHOD=" none "BROWSER_ONLY=" BROWSER_ONLY= "no" BOOTPROTO= "BOOTPROTO=" IPV4_FAILURE_FATAL= "no" IPV6INIT= "yes" IPV6_AUTOCONF= "yes" IPV6_DEFROUTE= "yes" IPV6_FAILURE_FATAL= "no" [root@lokott hello] # tail ifcfg-ens33 IPV4_FAILURE_FATAL= "no" IPV6INIT= "yes" IPV6_AUTOCONF= "yes" IPV6_DEFROUTE= "yes" IPV6_FAILURE_FATAL= "no" IPV6_ADDR_GEN_MODE= "stable-privacy" NAME= ens33 "UUID=" 0d6ffef5-693f-4d48-88b5-d2e1a66cf9c4 "DEVICE=" ens33 "ONBOOT=" yes
Wc (default all statistics)
-l: count rows-w: count words-c: count bytes [root@lokott hello] # cat 5.sh #! / bin/bashread-p "please input an ip address!" Ipping-C1 $ip & > / dev/nullif [$?-eq 0] then echo "$ip is up." else echo "$ip is down" fi [root@lokott hello] # wc-l 5.sh 9 5.sh [root@lokott hello] # wc-w 5.sh 30 5.sh [root@lokott hello] # wc-c 5.sh 147 5.sh [root@lokott hello] # retrieve and filter file contents
Grep command: find lines in the file that do not display the specified string
grep [options] PATTERN [FILE...] grep [options] [- e PATTERN |-f FILE] [FILE...]-I: ignore case-v: reverse lookup Output the line [root@lokott hello] # grep-I up 5.sh echo "$ip is up." [root@lokott hello] # grep-v 'bash$' / etc/passwd bin:x:1:1:bin:/bin:/sbin/nologindaemon:x:2:2:daemon:/sbin:/sbin/nologinadm:x:3:4:adm:/var/adm:/sbin/nologinlp:x:4:7:lp:/var/spool/lpd: / sbin/nologinsync:x:5:0:sync:/sbin:/bin/syncshutdown:x:6:0:shutdown:/sbin:/sbin/shutdownhalt:x:7:0:halt:/sbin:/sbin/haltmail:x:8:12:mail:/var/spool/mail:/sbin/nologinoperator:x:11:0:operator:/root:/sbin/nologingames:x:12:100:games:/usr/games:/sbin/nologinftp:x:14:50:FTP User:/var/ftp : / sbin/nologinnobody:x:99:99:Nobody:/:/sbin/nologinsystemd-network:x:192:192:systemd Network Management:/:/sbin/nologindbus:x:81:81:System message bus:/:/sbin/nologinpolkitd:x:999:998:User for polkitd:/:/sbin/nologinabrt:x:173:173::/etc/abrt:/sbin/nologinlibstoragemgmt:x:998:996:daemon account for libstoragemgmt:/var/run/lsm:/sbin/nologinrpc:x:32:32: Rpcbind Daemon:/var/lib/rpcbind:/sbin/nologincolord:x:997:995:User for colord:/var/lib/colord:/sbin/nologinsaslauth:x:996:76:Saslauthd user:/run/saslauthd:/sbin/nologinrtkit:x:172:172:RealtimeKit:/proc:/sbin/nologinpulse:x:171:171:PulseAudio System Daemon:/var/run/pulse:/sbin/nologinchrony:x:995:991::/var/lib/chrony:/sbin/nologinrpcuser:x:29:29:RPC Service User:/var/lib/nfs:/sbin/nologinnfsnobody:x:65534:65534:Anonymous NFS User:/var/lib/nfs:/sbin/nologinntp:x:38:38::/etc/ntp:/sbin/nologintss:x:59:59:Account used by the trousers package to sandbox the tcsd daemon:/dev/null:/sbin/nologinusbmuxd:x:113:113:usbmuxd user:/:/sbin/nologingeoclue:x:994:989:User for geoclue:/var/lib/geoclue:/sbin/nologinqemu: X:107:107:qemu user:/:/sbin/nologinradvd:x:75:75:radvd user:/:/sbin/nologinsetroubleshoot:x:993:988::/var/lib/setroubleshoot:/sbin/nologinsssd:x:992:987:User for sssd:/:/sbin/nologingdm:x:42:42::/var/lib/gdm:/sbin/nologingnome-initial-setup:x:991:986::/run/gnome-initial-setup/:/sbin/nologinsshd:x:74:74:Privilege -separated SSH:/var/empty/sshd:/sbin/nologinavahi:x:70:70:Avahi mDNS/DNS-SD Stack:/var/run/avahi-daemon:/sbin/nologinpostfix:x:89:89::/var/spool/postfix:/sbin/nologintcpdump:x:72:72::/:/sbin/nologinapache:x:48:48:Apache:/usr/share/httpd:/sbin/nologinroot@lokott hello] # grep-v 'bash$' / etc/passwd | wc-l / will After the results are written into the pipeline, use the wc command to display the number of results 40 [root@lokott hello] #
Ctrl + r can search for commands
[root@lokott hello] # vim ifcfg-ens33 use shortcut keys! Enter the following mode and enter the command that you typed before will automatically find
(reverse-i-search) `vested: vim ifcfg-ens33
Compress command
Gzip command and bzip2 command: make compressed files, extract files
-9 means high compression ratio-d decompress [root@lokott hello] # ls0.sh 5.sh ifcfg-ens33 linux [root@lokott hello] # gzip-9 0.sh 5.sh [root@lokott hello] # ls0.sh.gz 5.sh.gz ifcfg-ens33 linux [root@lokott hello] # gzip-d 0.sh.gz [root@lokott hello] # gzip-d 5.sh.gz [root@lokott hello] # ls0.sh 5.sh ifcfg-ens33 linux [root @ lokott hello] # bzip2-9 0.sh 5.sh [root@lokott hello] # bzip2-d 0.sh.bz2 [root@lokott hello] # bzip2-d 5.sh.bz2 [root@lokott hello] # ls0.sh 5.sh ifcfg-ens33 linux [root@lokott hello] #
Tar command: make archive file, release archive file
-c: create the package-x: extract the package-v: display the detailed process-f: execute-p: retain the original permissions-t: view the contents of the package-C: extract it somewhere-z:gz format-j:bz2 format [root@lokott hello] # ls0.sh 5.sh ifcfg-ens33 linux [root@lokott hello] # tar czvf if.tar.gz ifcfg-ens33 ifcfg-ens33 [root@lokott hello] # ls0. Sh 5.sh ifcfg-ens33 if.tar.gz linux [root@lokott hello] # tar xzvf if.tar.gz-C.. / ifcfg-ens33 [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 ifcfg-ens33 linux [root@lokott shell] # / / if it is in bz2 format, change the suffix name of the file format and replace z with j. Text editor vi/vim (proficiency in vim editors can improve productivity)
Action
Create or modify text files to maintain various configuration files in the Linux system
Command mode, input mode, last line mode (bottom line command mode) conversion relationship and operation
Related operation commands of vim editor
Line number setting operation
: set nu:set nu! And: set nonu cancel line number attention! Remember to switch to last line mode (bottom line command mode)
Locate the line (in command mode)
Gg: navigate to the beginning G: navigate to the end 3G:3 represents the line number, navigate to the third line
Copy, paste, delete
X: delete a single character at the cursor dd: delete the current cursor line dw: delete a word where the cursor is located # dd: delete the # line content starting from the line where the cursor is located ddp: swap the position between the upper and lower lines yy: copy the line change to the clipboard nyy: copy n lines to the clipboard p: paste
Other actions in the vim editor
Shift+r replacement replaces at the cursor
PG UP turns the page up
PG DN turns the page down
: e ~ / install.log opens a new file for editing (in last line mode)
R file-- reads data from another archive in the edited data. Also add the contents of the file "filename" to the line where the cursor is located (in the last line mode)
W / opt/test.txt writes the file to opt and renames it to test.txt file but does not maintain the same permissions as the source file
N1 word1 n2sqqqword1max Word2Universe g change all word1 to word2 between N1 and N2 lines
:% s/word1/word2/g change all word1 to word2
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.