一次建立多个目录php
[root@localhost tmp]# mkdir -p /user/{folder1,folder2,folder3} [root@localhost tmp]# ls /user/ folder1 folder2 folder3
找出根目录下最大的10个目录,并按使用空间从大到小排序node
[root@localhost ~]# du -a ./ | sort -nr | head -n 10 132380 ./ 132316 ./source 69916 ./source/ZendGuard-5_5_0.tar.gz 18720 ./source/xunzai.com_mysql-5.0.18.tar.gz 13732 ./source/php-5.4.11.tar.gz 6144 ./source/phpMyAdmin-3.5.6-all-languages.tar.gz 5996 ./source/httpd-2.4.3.tar.gz 5044 ./source/libxml2-2.9.0.tar.gz 1984 ./source/pcre-8.32.zip 1960 ./source/freetype-2.4.10.tar.gz
查看根目录下全部以“.”开头的文件mysql
[root@localhost ~]# find ./ -name ".[^.]*" ./.bash_logout ./.bash_profile ./.bashrc ./.cshrc ./.tcshrc ./.cache ./.config ./.bash_history ./.xauth96WqtE ./.mysql_history ./.mysql_history.TMP ./.viminfo
修改文件或目录的时间戳sql
[root@localhost ~]# stat person.txt File: ?.erson.txt? Size: 74 Blocks: 8 IO Block: 4096 regular file Device: 803h/2051d Inode: 145535279 Links: 1 Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root) Context: unconfined_u:object_r:admin_home_t:s0 Access: 2016-04-02 05:05:10.370059171 -0700 Modify: 2016-04-02 05:04:40.854898705 -0700 Change: 2016-04-02 05:04:40.913901033 -0700 Birth: - [root@localhost ~]# touch -t 201604052135 person.txt #格式为YYMMDDhhmm [root@localhost ~]# stat person.txt File: ?.erson.txt? Size: 74 Blocks: 8 IO Block: 4096 regular file Device: 803h/2051d Inode: 145535279 Links: 1 Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root) Context: unconfined_u:object_r:admin_home_t:s0 Access: 2016-04-05 21:35:00.000000000 -0700 Modify: 2016-04-05 21:35:00.000000000 -0700 Change: 2016-04-05 06:36:16.304945163 -0700 Birth: -
快速备份一个文件:cp filename{,.bak}vim
[root@localhost ~]# ls anaconda-ks.cfg person.txt source [root@localhost ~]# cp person.txt{,.bak} [root@localhost ~]# ls anaconda-ks.cfg person.txt person.txt.bak source
进程运行到后台bash
[root@localhost ~]# Ctrl + z
进程运行到前台ide
[root@localhost ~]# fg
随机产生10位字符数的十六进制数debug
[root@localhost ~]# openssl rand -hex 10 c3e805e84074211cc698
将文件解压到新的目录xml
[root@localhost src]# ls apr-1.4.6.tar.gz libmcrypt-2.5.8.tar.gz apr-util-1.5.1.tar.gz libpng-1.5.14.tar.gz autoconf-2.69.tar.gz libxml2-2.9.0.tar.gz debug pcre-8.32.zip freetype-2.4.10.tar.gz php-5.4.11.tar.gz gd-2.0.35.tar.gz phpMyAdmin-3.5.6-all-languages.tar.gz httpd-2.4.3 xunzai.com_mysql-5.0.18.tar.gz httpd-2.4.3.tar.gz ZendGuard-5_5_0.tar.gz jpegsrc.v8b.tar.gz zlib-1.2.7.tar.gz kernels [root@localhost src]# tar zxvf apr-1.4.6.tar.gz -C /tmp/tmp/ apr-1.4.6/ apr-1.4.6/shmem/ apr-1.4.6/shmem/win32/ ………… [root@localhost src]# ls /tmp/tmp/ apr-1.4.6
将全部文件名中含有”txt”的文件移入“/tmp/tmp”目录排序
[root@localhost ~]# find -iname "*txt*" -exec mv -v {} /tmp/tmp/ \; ?./person.txt?.-> ?.tmp/tmp/person.txt? ?./person.txt.bak?.-> ?.tmp/tmp/person.txt.bak? [root@localhost ~]# ls /tmp/tmp/ apr-1.4.6 person.txt person.txt.bak
将任意一行开头为“#”的去除掉
[root@localhost ~]# cat a.txt This is the file #This is another file #This is the final file [root@localhost ~]# sed '2s/^#//' a.txt This is the file This is another file #This is the final file