Linux Command


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
15. rpm
Check the installation path of an installed package
$ rpm -ql package-name
Install a package from .rpm
rpm –ivh packagename.rpm

16. sudo的配置文件位于/etc/sudoers,需要root权限才可以读写。
找到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

17. Shell Environment Path:
Global: /etc/profile

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值