Some basic commands in Linux

Check the size of the folder

 du -h /home/oracle11_7/MainSoftCache/

View the number of files in a folder

 ls -l |grep "^-" | wc -l

delete everything under the folder

rm -rf /home/oracle11_7/MainSoftCache/*

When there are too many files, an error rm will be reported: Argument list too long

Use this command ls | xargs -n 10 rm -fr ls means to output all file names (separated by spaces) xargs is to group the output of ls, every 10 as a group (separated by spaces), as rm -rf The parameter means that all file names are grouped by 10 and deleted by rm -rf

Check CPU usage

First execute top -u username

Then press number key 1

View java process

ps -ef | grep java

View the resource usage of each process (sorted by rsz as the actual memory from large to small)

ps -e -o 'pid,comm,args,pcpu,rsz,vsz,stime,user,uid' | grep oracle |  sort -nrk5

open port number

iptables -I INPUT -p tcp --dport 8100 -j ACCEPT

service iptables save

service iptables restart iptables

View port list

lsof -i:80  

iptables -L INPUT --line-numbers

Recursively authorize folders

chmod -Rf 777 oracle /home/oracle/Oracle/Middleware/

Delete mistyped characters in command mode

Ctrl+Backspace

rpm command

rpm -ivh package name

Install the package and display the installation progress.

Turn firewall on and off

  Temporary effective, restore after restart

开启: service iptables start
关闭: service iptables stop
 
永久性生效,重启后不会复原
开启: chkconfig iptables on
关闭: chkconfig iptables off

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326403077&siteId=291194637