In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article shows you how to understand SHELL, the content is concise and easy to understand, can definitely brighten your eyes, through the detailed introduction of this article, I hope you can gain something.
Before reading the following sections, readers are strongly advised to open a shell experiment, which is not a major item in shell textbooks:
! $
! $is a special environment variable that represents the last string of the previous command. For example, you may be like this:
1$ mkdir mydir
2$ mv mydir yourdir
3$ cd yourdir
It can be changed to:
1$ mkdir mydir
2$ mv! $yourdir
3$ cd! $
Sudo!!
Execute the previous command as root.
Scenario example: for example, root identity is required when installing software packages with apt-get in Ubuntu, and we often forget to add sudo before apt-get. Every time you have to add sudo and retype this command, you can easily use sudo! We're done.
Chen Hao Note: under shell, sometimes you type a very long command, you can use! xxx to repeat the most recent command, for example, you have typed vi / where/the/file/is before, you can use it next time! vi is as heavy as the last vi command. )
Cd-
Go back to the last directory.
Scenario example: the current directory is / home/a, switch to / home/b with cd.. / b. You can then easily switch back and forth between / home/an and / home/b by repeatedly executing the cd-command.
(Chen Hao's note: cd ~ is to return to your Home directory, cd ~ user is to enter a user's Home directory.)
'ALT+.' Or'.
Hot-built alt+. Or esc+. You can repeat the parameters from the last command line.
^ old ^ new
Replace part of the string in the previous command.
Scene: echo "wanderful", actually wants to output echo "wonderful". All you need is ^ a ^ o, which is of great help to the misspelling of long commands.
Du-s * | sort-n | tail
List the 10 largest files in the current directory.
W! sudo tee%
Save a file in vi that only root can write
Date-dice 1234567890
Time intercept time
> file.txt
Create an empty file that is shorter than touch.
Mtr coolshell.cn
The mtr command is better than traceroute.
Add a space before the command line, and the command will not enter the history.
Echo "ls-l" | at midnight
Run a command at some time.
Curl-u user:pass-d status= "Tweeting from the shell" http://twitter.com/statuses/update.xml
Update twitter on the command line.
Curl-u username-- silent "https://mail.google.com/mail/feed/atom" | perl-ne 'print"\ t "if / /; print" $2\ n "if / (. *) /;'
Check your gmail unread email
Ps aux | sort-nk + 4 | tail
List the first ten processes that consume the most memory
Man ascii
Displays the ascii code table.
Scene: do you still need google when you forget the ascii code table? Especially in the case that the Chinese network is so "smooth", it is even more troublesome to apply the rules in GWF, just use the local man ascii.
Ctrl-x e
Quickly launch your default editor (set by the variable $EDITOR).
Netstat-tlnp
Lists the port number on which the native process is listening.
Tail-f / path/to/file.log | sed'/ ^ Finished: SUCCESS$/ Q'
Exit tail when Finished: SUCCESS appears in file.log. This command is used to monitor and filter the occurrence of a record in log in real time.
Ssh user@server bash < / path/to/local/script.sh
Run a script on the remote machine. The biggest advantage of this command is that you don't have to copy the script to the remote machine.
Ssh user@host cat / path/to/remotefile | diff / path/to/localfile-
Compare a remote file with a local file
Net rpc shutdown-I ipAddressOfWindowsPC-U username%password
Shut down a Windows machine remotely
Screen-d-m-S some_name ping my_router
Run a non-stop program in the background, and you can check its status at any time. The-d-m parameter starts the "detach" mode, and-S specifies the identity of a session. You can remount an identified session with the-R command. Please refer to screen usage man screen for more details.
Wget-- random-wait-r-p-e robots=off-U mozilla http://www.example.com
Download the entire www.example.com website.
Curl ifconfig.me
When your machine is on the intranet, you can use this command to check the IP of the extranet.
Convert input.png-gravity NorthWest-background transparent-extent 720x200 output.png
Change the size of the picture
Lsof-I
View the activity status of the local network service in real time.
Vim scp://username@host//path/to/somefile
Vim a remote file
Python-m SimpleHTTPServer
In a word, implement a HTTP service, set the current directory to the HTTP service directory, which can be accessed through http://localhost:8000, which is perhaps the simplest implementation of a HTTP server on the planet.
History | awk'{CMD [$2] +; count++;} END {for (an in CMD) print CMD [a] "" CMD [a] / count*100 "%" a}'| grep-v ". /" | column-c3-s "- t | sort-nr | nl | head-N10
(Chen Hao's note: it's a bit complicated, history | awk'{print $2}'| awk 'BEGIN {FS= "|"} {print $1}' | sort | uniq-c | sort-rn | head-10)
This line of script instincts to output the ten commands you use most often, so you can even gain insight into what kind of programmer you are.
Tr-c "[: digit:]" < / dev/urandom | dd cbs=$COLUMNS conv=unblock | GREP_COLOR= "1 partner 32" grep-- color "[^]"
Want to see the screen effect of Marix? Not very much, but also very Cool!
The above content is how to understand SHELL. Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.
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.