In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
5. History command function: view and use historical commands (up to 1000 records) save location: ~ / .bash_history 1. When starting the terminal, it will automatically read the historical commands from ~ / .bash_history, load them into memory 2, execute the commands in the terminal, and keep the history of the commands in memory. 3. When the terminal is closed. Will automatically save the history commands in memory to the shortcut operation of history in ~ / bash_history! Num: execute the history command numbered num in the history command! String: find the command that starts with the specified string in the history command and execute it once, and find it from the bottom up! : the last order was carried out! -num: execute the penultimate num command in the history command if you retain the history command, * our system knows what the server has done through the history command. There are times when historical commands need to be controlled. -c: clear the history command (in memory) when starting the terminal Read the history command from ~ / .bash_history [root@localhost ~] # history-c [root@localhost ~] # [root@localhost ~] # history 1 history-a: manually save the history command in memory to a file-r: reread the history command from ~ / .bash_history-d: num: delete the specified number Historical commands (* when other people's systems Erase your own operation command) 6. Ls command: show files in the current or specified directory options-a: show all files in the directory (including hidden files)-l: show the detailed properties of files and directories-d: show the directory itself (show files in the directory if you don't use-d)-h: use in conjunction with-l Display the size of the directory in an easy-to-read way, (only show the size of the file, not the size of the directory)-t: sort by the modification time of the file, put the last modified file first-r: used in combination with-l-t Reverse sort example: show the following files [root@localhost ~] # ls / 1.txt 2.txt bin cgroup etc lib lost+found misc net proc sbin srv tmp var 1.xtx 3.txt boot dev home lib64 media mnt opt root selinux sys usr black and white color is a general file Blue is the directory example: show which files are in the current directory # ls. / # ls (the current location is. /, but can be omitted) example: create a file and view the details of the file [root@localhost tmp] # mkdir book [root@localhost tmp] # touch book/ {linux,python Go} [root@localhost tmp] # ls book/ go linux python [root@localhost tmp] # ls-l book/ total 0-rw-r--r-- 1 root root 0 Apr 12 18:03 go-rw-r--r-- 1 root root 0 Apr 12 18:03 linux-rw-r--r-- 1 root root 0 Apr 12 18:03 python example : show detailed properties of a.txt # ls-l a.txt example: show detailed properties of book directory [root@localhost tmp] # ls-ld book drwxr-xr-x 2 root root 4096 Apr 12 18:03 book [root@localhost tmp] # cd book/ [root@localhost book] # ls go linux python [root@localhost book] # vi go [root@localhost book] # vi linux [root@localhost book] # vi python [root@localhost book] # ls-l total 12-rw-r--r-- 1 root root 164Apr 12 18:11 go-rw-r--r-- 1 root root 83 Apr 12 18:13 linux-rw-r--r-- 1 root root 165Apr 12 18:13 python ls-lh Total 45m-rw-r--r-- 1 root root 164Apr 12 18:11 go-rw-r--r-- 1 root root 45m Apr 12 19:01 linux-rw-r--r-- 1 root root 98K Apr 12 18:48 python-h shows only the file size Do not display the size of the directory example: [root@localhost book] # cd.. [root@localhost tmp] # ls-l-h total 4.0K drwxr-xr-x 2 root root 4.0K Apr 12 19:04 book displays the size of the directory with the du command, which is not explained too much here. It will be explained in detail when explaining the disk. -t put the last modified file first [root@localhost tmp] # cd book/ [root@localhost book] # ls go linux python [root@localhost book] # ls-l total 45676-rw-r--r-- 1 root root 164Apr 12 18:11 go-rw-r--r-- 1 root root 46661650 Apr 12 19:01 linux-rw- Rmuri root root 99824 Apr 12 18:48 python [root@localhost book] # vi linux [root@localhost book] # ls-l-t total 45676-rw-r--r-- 1 root root 46661656 Apr 12 22:27 linux-rw-r--r-- 1 root root 99824 Apr 12 18:48 python-rw-r--r-- 1 root root 164Apr 12 18 11 go [root@localhost book] # vi go [root@localhost book] # ls-l-t total 45676-rw-r--r-- 1 root root 167 Apr 12 22:27 go-rw-r--r-- 1 root root 46661656 Apr 12 22:27 linux-rw-r--r-- 1 root root 99824 Apr 12 18:48 python absolute path and relative Path absolute path: start from the root directory to find the relative path: the path relative to the current location creates a file a.txt [root@localhost home] # mkdir a [root@localhost home] # touch / home/a/a.txt absolute path [root@localhost home] # touch. / a/a.txt relative path in the home directory. Path (premise must be under home) [root@localhost home] # touch a/a.txt relative path (premise must be under home) touch. / a/a.txt (premise must be under home) touch a/a.txt (premise must be under home) example: switch to / etc/init.d directory requires 1: under init.d New directory abc requirement 2: create a new directory under / etc abc 1: method 1: relative path [root@localhost home] # cd / etc/init.d [root@localhost init.d] # mkdir abc [root@localhost init.d] # ls abc autofs cups kdump netconsole ntpdate rdisc [root@ Localhost ~] # mkdir / etc/init.d/abc [root@localhost ~] # .ls / etc/init.d/abc autofs cups kdump netconsole ntpdate rdisc rpcsvcgssd sssd absolute path: mkdir / etc/abc relative path: mkdir.. / abc 7, Cat command full name: concatenate (connect and display: splice multiple files) function: display the content format of a text file: cat [options] File options:-n: display line number 361cat / etc/init.d/halt 362cat-n / etc/init.d/halt-E in front of each line: Show line Terminator add: newline character for files in windows:\ nnewline character for files in linux: $(such symbols are implicit symbols-are invisible by default) 8. The function of the tac command: to display the contents of a file in reverse order (the last line becomes the first line) [root@localhost tmp] # vi 1.txt 11111 2222 3333 444,555 [root@localhost tmp] # tac 1.txt 555444 3333 2222 11111
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.