1. rm
Romove a program in Ubuntu
2. ps
Display the current running process
3. pstree
Display the current running process following a tree structure
4.pgrep
Doing regular expression check on all the current running process
4. apt-get:
-y, --yes, --assume-yes
Automatic yes to prompts. Assume "yes" as answer to all prompts and run non-interactively. If an undesirable situation, such as changing a held package or removing an essential package, occurs then apt-get will abort.
5.run a program:
./
6.cp -a #a=archive flag
cp -r #r=recursive flag
7. nslookup
8. rm -r <directory_name>
Remove a full directory
9. df
check disk usage
du -h
10. source ~/.bashrc
Reload bashrc
11. find
find /path -name 'ABC'
find /path -name '*ABC*'
12. Bash redirect
Use this - "require command here" > log_file_name 2>&1
Detail description of redirection operator in Unix/Linux.
The > operator redirects the output usually to a file but it can be to a device. You can also use >> to append.
If you don't specify a number then the standard output stream is assumed but you can also redirect errors
> file redirects stdout to file
1> file redirects stdout to file
2> file redirects stderr to file
&> file redirects stdout and stderr to file
/dev/null is the null device it takes any input you want and throws it away. It can be used to suppress any output.
13. Ctrl-C sends the interrupt signal SIGINT. By default, this signal crashes most programs, though some interactive ones handle it as an instruction to stop what they're doing and return to a command prompt.
Ctrl-Z sends SIGSTOP, which freezes the program. To restart it from the same point, you need somehow to send a SIGSTART. This can be done by using the commandsfg (to restart it as a foreground process) or bg to restart it in the background.
14. Create a new empty file:
touch /path/to/file
for an empty file
$ rpm -ql package-name
Install a package from .rpm
找到root ALL=(ALL) ALL这一行,在后面再加上一行就可以了(不用引号):
“username ALL=(ALL) ALL”
其中username为指定的使用sudo的用户,引号内的空格为tab
如果你想每次使用sudo命令的时候都提示你输入根密码,移动到这一行:
#%wheel ALL=(ALL) ALL
解除#号注释
如果你不想每次使用sudo命令的时候都提示你输入跟密码,移动到下面这一行:
#%wheel ALL=(ALL)NOPASSWD:ALL
解除#号注释
保存后退出
添加用户名到wheel用户组:
usermod -G wheel username
Current User: ~/.bashrc
18. Configure Elasticsearch to automatically start during bootup
Chkconfig: => change run-level configuration
Service: service XXX start => add a script to the start service list
chkconfig --add elasticsearch
Otherwise if your distribution is using systemd:
sudo /bin/systemctl daemon-reload sudo /bin/systemctl enable elasticsearch.service
Ubuntu Equivalent:
update-rc.d <service> defaults
update-rc.d <service> start 20 3 4 5
update-rc.d -f <service> remove