Some useful linux commands

These are mostly used linux commands I applied daily, I paste it here once it is useful for you.

1.        

Permanently set the Environment Variables

 

classpath=” ”

export classpath

2.        

To see the hardware configuration

 

cat /proc/cpuinfo

3.        

Tar commands

 

tar –xvvzf myfile.tar.gz  // to leave the .tar.gz unchanged

 

tar –pczf myfile.tar.gz  /path/...  // to compress

 

gzip –c test.text>test.gz

 

tar –xvvf myfile.tar  // to extract

4.        

To change the login user name

 

su username

5.        

To see the size of file or directory

 

du –skh filename

6.

To show the disk space

 

df -h

6.        

Copy files from one computer to another

 

scp myfile username@xxx.xxx.xxx:c:/   

scp myfile username@xxx.xxx.xxx:/opt/   // where xxx is the hostname of target computer

7.        

To see the CUP and Memory usage

 

top

8.        

Vi commands

 

vi myfile.config  // to view the file

 

:q  // to exit

 

:q!  // to exit witout the change

 

:wq  // to exit with change

 

:cw  // change word

 

:cc  // change a line

9.        

Make a backup file

 

cp –b myfile1 myfile2

10.    

Create direcory

 

mkdir mydirectory

11.    

Set file permission

 

chmod 777 mybatch.sh

12.    

To check the OS

 

cat /etc/redhat-release

13.    

Force to delete the directory

 

rm –rf direcory

14.    

Search for a file name

 

find . –name myfile

15.    

Start Xwin X server

 

Start Cygwin Bash Shell

cd /usr/x11R6/bin

./startxwin.bat

16.

View IP Address

 

hostname -i

17.

View and kill Processes

 

ps: to view processes

kill -9 process id

18.

Copy the entire directory

 

cp -R dir/ newdir/

19.

View port

 

Netstat –an | grep 9081

Netstat –an > /tmp/port.out

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值