unix basic command

1. get start

CommandExampleDescription
ls 

ls

ls -a

ls -l

输出目录文件

输出文件包括隐藏文件

输出文件详细信息

pwd    

pwd

show present working dir

cd

cd dir

cd ..

cd ./a/b

cd ~icey/a

cd /home/username/documents

change dir

返回上一个目录

到当前目录下的a/b文件夹中

到某个用户的子文件夹

从根目录开始

mkdirmkdir icey创建文件夹  
rmdirrm emptydir删除一个空的文件夹
rm

rm file.txt

rm *.tmp

 -f

-i

-r

-v

rm -rf dir

 

删除一个文件

删除后缀为..的文件

强制删除

交互式删除

递归删除

详细显示

删除文件夹

 

cp

cp file1 dir

cp file1 file1copy

 
mv

mv oldfilename newfilename

mv filename dir

重命名文件

移动文件到文件夹

moremore file查看文件
lprlpr file打印:send file to printer
manman ls  帮助:online help about cmd
clscls清屏 clear screen

 

查看日期:date

安装软件  sudo apt-get install softwareName

解压缩   tar -cf abc.tar subdir

      tar -xvf subdir.tar

 

2. viewing files

cat filename    Dump a file to the screen in ascii.

more filename   Progressively dump a file to the screen: ENTER = one line down SPACEBAR = page down q=quit

less filename     Like more, but you can use Page-Up too. Not on all systems.

vi filename      Edit a file using the vi editor. All UNIX systems will have vi in some form.

emacs filename  Edit a file using the emacs editor. Not all systems will have emacs.

head filename    Show the first few lines of a file.

head -n filename  Show the first n lines of a file.

tail filename     Show the last few lines of a file.

tail -n filename   Show the last n lines of a file.

2. log on/log off

注销用户 logoff

    exit
重启 shutdown -r /t 000
关闭 shutdown -p

 

字符终端------图形界面  Character terminal -- graphical interface transform

Character terminal ——> graphical interface

enter: startx

or alt+ctl+space ,release "space", and press F7

graphical interface ——> Character terminal

alt+ctl+F1

 

3. OS performance

(1)进程

ps    查看进程

kill -9 psid  结束进程

ctl+c  结束当前进程

(2)内存(memory)和CPU

free -m  查看内存使用情况

top    查看内存及cpu使用情况


也可以安装htop工具,这样更直观,
安装命令如下:sudo apt-get install htop
安装完后,直接输入命令:htop
就可以看到内存或cpu的使用情况了。

 

(3)user

who     --list who is logged on machine

finger  --list who is on compter in the lab

转载于:https://www.cnblogs.com/iceyCSE/p/5426736.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值