WS实习的linux常用指令

来源:互联网 发布:淘宝大叶紫檀手串 编辑:程序博客网 时间:2024/06/03 13:14

 隐藏文件:

以.开头的,会被当作是隐藏文件或或文件夹。使用ls -a 可以显示出来。如果是使用删除 rm -rf /media/flash/*, 则这些隐藏文件不会被这个指令删除(即, 星号不会选中它们)。

===================================================

#!!!查看某一个大文件的某一行!!!!

sed '52q;d' < DRAE.tab

#vi跳到开头

gg

#vi跳到结尾

shift+g

===================================================

搭建http服务器端:

# ubuntu http serversudo apt-get install apache2# sudo vi /etc/apache2/httpd.conf<VirtualHost *:80>ServerName localhostDocumentRoot /home/usr</VirtualHost><Directory />      Options None      AllowOverride None</Directory><Directory "/home/usr">    Options Indexes FollowSymLinks    AllowOverride None    Order allow,deny    Allow from all</Directory>sudo /etc/init.d/apache2 restart

这样子,在设备上可以通过wifi连接来获取/home/usr下面的文件

#在电脑上,先将需要的文件拷贝到/home/usr,需要sudo权限

sudo cp a.file /home/usr

#在设备上,获得

wget http://192.168.0.47/a.file

===================================================

其他一般性的操作

#创建文件夹

mkdir /media/flash/.tts

#删除,目录的话,要加上-r

rm -r /media/flash/.tts

#显示文件

ls

#显示文件,权限,以及时间等信息

ll

#显示文件,以及大小

ls -sh

#显示隐藏文件

ls -a

#移动,或命名

mv a.file b.file

#复制

cp a.file /media/flash/b.file

#安装

sudo apt-get install XXX

#压缩

[root@linux ~]# tar -cvf /tmp/etc.tar /etc<==仅打包,不压缩!
[root@linux ~]# tar -zcvf /tmp/etc.tar.gz /etc<==打包后,以 gzip 压缩
[root@linux ~]# tar -jcvf /tmp/etc.tar.bz2 /etc<==打包后,以 bzip2 压缩

[root@linux tmp]# tar -zxvf /tmp/etc.tar.gz etc/passwd

#将/etc 目录压缩为etc.rar 命令为:

rar a etc.rar /etc

#将etc.rar 解压 命令为:
rar x etc.rar 

#with full path
unrar x etc.rar

#to current 
unrar e etc.tar

#zip

zip -r yasuo.zip abc.txt dir1

 unzip yasuo.zip

#图形方式打开一个文件夹

nautilus /home/usr

#创建一个新文件

touch a.file

#grep

ls  | grep "test"

#重定向

ls  | grep "test" > test.file

#杀死进程

killall gui_shell

#后台运行

gui_shell&

#查看运行进程

ps

#查看动态,包括CPU,MEM等

top

#make

make -j 8

#rake , 与Rakefile有关

rake build:arm:all

#串口工具,-D选择使用哪个

minicom -D /dev/ttyUSB0

#卸载USD

umount /media/sd

#给文件打补丁

patch -p1 < diff.txt

原创粉丝点击