Posts

Showing posts with the label Commands

[ Level 1 ] create cpio file with find.

Cpio is a good tool to pack files in one image, and it's fast. You could use find command to find files that you want and also use gzip to compress it. ex. $ find ./ -print | cpio -o -Hnewc | gzip > /tmp/my.cpio.gz Wish this helps. regards, Stanley Huang

[Level 1] Install autoexpect

$ autoexpect -f ./auto.exp autoexpect started, file is ./auto.exp $ ssh stanley@localhost The authenticity of host 'localhost (127.0.0.1)' can't be established. RSA key fingerprint is 36:12:a4:49:26:fe:18:0d:77:bf:c7:e8:36:86:b7:f2. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'localhost' (RSA) to the list of known hosts. stanley@localhost's password: Welcome to Ubuntu 11.04 (GNU/Linux 2.6.38-10-generic x86_64) * Documentation: https://help.ubuntu.com/ *** /dev/sda5 will be checked for errors at next reboot *** Last login: Thu Jul 28 12:17:50 2011 from stanley-ubuntu $ ls apache-cassandra-0.8.1-SNAPSHOT.jar Public auto.exp Rock Desktop script.exp Documents scripts Downloads scripts_20110302.tgz eclipse Self_assesment_201103.pdf English_Survey.pdf SUR-1-Vesu_Pi...

[Level 2] How to simulate udevinfo in Ubuntu 11.04

When you try to use command udevinfo in Ubuntu 11.04, you would get the response "udevinfo: command not found". How to simulate the command udevinfo? Use command udevinfo with info option. Ex. # udevadm info -q all -n /dev/video0 You could also create a function named udevinfo as you like Ex. # udevinfo () { udevadm info -a -p `udevadm info -q path -n "$1"`; } # udevinfo /dev/video0 ... Wish this helps. regards, Stanley Huang

[Level 1] How to grep in file.

Just use -P and '\t' with grep command. Ex. # grep -P '\t' /etc/passwd Wish this helps. regards, Stanley Huang

[Level 2] Remove all folders without any file.

If you want to remove all folders without any file, you can use the command to remove it. # find ./ | sort -r | xargs rmdir 2>/dev/null Wish this helps. regards, Stanley Huang

[Level 2] How to create a FAT32 file system on OpenSolaris

Today, my colleague ask me how to create FAT32 on OpenSolaris~ Actually, you can use the command "mkfs" to create it. # mkfs -F pcfs -o FAT=32 /dev/rdsk/c1t0d0p0:1 ref: man page, mkfs_pcfs(1M) Wish this helps. regards, Stanley Huang