Thanks to lecturer / a talk show, Du Yidong
Content Preview
In their daily work, with its command-line tool has powerful features and simple interactive form to dominate the Unix-like operating system.
If you can not find a suitable tool to worry about when using the command-line tool? Whether feel powerless in the face of complex tasks?
The workshop will shell command you uncover the mystery! The escape of Linux by the Chamber of Secrets tour, you will have some practical skills in shell, GUI go beyond the limit, increase work efficiency.
Officially started
Scene: vagrant start the virtual machine, log on Linux machines using ssh "quick" and found that Tomcat did not start, after starting port has been occupied
http://192.168.33.20:8080/
, and then kill off the process but found that the content is compressed and then could not find the switch user (to find the password) found file, unpacked only to find content from being tampered, and then replace the contents of a button finally restore the page.
Commands / Shortcuts | Explanation / action / Remarks |
---|---|
ssh-keygen -t rsa |
Subsequent selection of the folder may be generated at the current key position |
scp id_rsa.pub [email protected]:/.ssh |
Copy of the public key ( id_rsa.pub ) to the server |
cat id_rsa.pub >> authorized_keys |
Quickly add content to a specific file > coverage, >> increase |
ssh -i ./id_rsa [email protected] |
( --identity_file Bring authentication keys) |
echo IdentityFile $PWD/id_rsa >> ~/.ssh/config |
File Path command line id_rsa increase to the specified configuration file |
ssh bws |
ssh + Alias Host, quickly log into a Linux machine |
tldr systemctl |
>> man tldr good in man, but more slowly |
Commands / Shortcuts | Explanation / action / Remarks |
---|---|
set -o emacs |
Set bash shortcuts mode |
Ctrl + A |
Jump to the beginning of the line |
Ctrl + E |
Skip to end of line |
Ctrl + U |
Clear current input |
Ctrl + R |
Search-history |
Ctrl + L |
Clear the screen, but keep records |
Ctrl + K |
Delete from the current position to the end |
Ctrl + W |
Delete the word |
Commands / Shortcuts | Explanation / action / Remarks |
---|---|
grep -v ^# .README.md |
Notes to find non-news |
lsof -i:8080 |
Find a specific port process |
ps -ef|grep java |
Find a specific program process |
sudo systemctl restart tomcat |
systemctl is arbitrary commands, sudo |
cat /proc/version |
Viewing System Info |
Linux version 3.10.0-327.18.2.el7.x86_64 ([email protected]) (gcc version 4.8.3 20140911 (Red Hat 4.8.3-9) (GCC) ) #1 SMP Thu May 12 11:03:55 UTC 2016
Commands / Shortcuts | Explanation / action / Remarks |
---|---|
grep -rI 747339117 . |
Find specific text file |
set encoding:utf-8 |
vim set the encoding |
Ctrl + Z |
vim into the background process |
fg + Enter |
Return vim background process |
find root_path -name '*.tar.gz' |
Find specific file name suffix |
find / -name "*.tar.gz" 2>>/dev/null |
Error filter unwanted information (2) |
cat /etc/passwd |
View user used |
su - Darker |
Switch to the new user and the shell (with environment variables) (A Mere - the implies -l , --login .) |
[dev@localhost ~]$ su Darker
Password:
[Darker@localhost dev]$ sudo -iu dev
[dev@localhost ~]$
grep -r "Darker" |
Locate the password U2Fsd, and then find a tar package |
.README.md:This is the message: Check the port and kill the process, you can start tomcat right. # Kissing your hand may make you feel very good, but a diamond and sapphire bracelet lasts for ever. -- Darker:U2Fsd,
Commands / Shortcuts | Explanation / action / Remarks |
---|---|
tldr locate |
You can also quickly locate files and save memory, but requires sudo privileges |
alias ll='ls -al' |
Set aliases (only take effect in the current process, write .bashrc ) |
tar -zxvf /home/Darker/.src/20/.web.tar.gz |
Unzip the file, pay attention to -z the parameters of different roles in different systems |
sudo mv index.html /usr/share/tomcat/webapps/ROOT/ |
It looks good but found the web page content has been tampered with |
sudo sed -i 's/Darker/ThoughtWorkers/g' index.html |
Replace Text /find/replace/ |
sed -r 's/regex/replace/g' filename |
It is used to replace regular expressions |
cd /etc/sudoers.d/ |
New files can be set up sudo permissions for each user |
sudo -l |
Sudo permission to view the current user |
history |
See all command records |
Ctrl + D |
Return to the previous Session, for continuous exit |
pstree |
Show all the process tree |
Prohibition page right? Use JavaScript can do, listen to events always returns false .
The Z-Shell at The Installing (zsh) ON Linux, Mac OS and the X-Windows , but also need sudo privileges.
Finally!!!
Also I must say Dash handy, easy to cry, / (¨Ò o ¨Ò) / ~ ~
Thinking a bit small
- A question about the DevOps? The duration of their work is a burst of it? If you have done one time, then the property becomes a thing once and for all, would not after all do not have to maintain it?
- How DevOps enables a steady stream of demand for their work to ensure that the need for it, (manual smile) And this seems to be the nature used to do consulting projects for it?
- 另一方面的思考就是,正因为其不持续的必要性,DevOps 应当作为开发者的基本素质而不应为其专门设置职位,在迭代开始的最早期就把最困难的部分做好做完善,一劳永逸。
- 而随着 AWS 等各类“服务”性质平台的不断完善,这方面的工作大概会越来越少并且现有工具、脚本都将成为资产,值得被维护,也应当被持续维护,但属于 Developer 分内的事情。