where is my command binaries and its configurations?

February 9th, 2008 mysurface

When we want to find out the absolute path for a command, we will usually use which. For examples, if I want to check out the absolute path for mplayer, I may do this: which mplayer But there is another command can search for the binaries as well as configs and man pages. whereis mplayer [...]

Posted in Common, whereis | Hits: 31886 | No Comments »

Obtain some system statistics from vmstat

December 8th, 2007 mysurface

vmstat know as virtual memory statistics reporter, but it gives more information the just only virtual memory. Besides memory, it covers overall CPU usage, IO, Swap, Proc, System interupts and context switching. vmstat is pretty easy to use, ignores all other options, the normal usage will be looks like this: vmstat [delay] [counts] Let say, [...]

Posted in Admin, date, tail, vmstat | Hits: 88084 | 4 Comments »

How to redirect output to a file as well as display it out

December 6th, 2007 mysurface

To redirect standard output to a file is easy, you just need to use the redirection symbol, for example: echo “hello world” > test.txt But what if I want to display it out as well as store into a file? Answer: tee echo “hello world” | tee test.txt Okay it seems very easy, how about [...]

Posted in pipeline, python, tee, Text Manipulation | Hits: 279557 | 38 Comments »

stupid way to make mplayer repeatly play

November 3rd, 2007 mysurface

I am so desperately wanna make mplayer repeat a song, somehow I obtain a song in flv format. I fail to figure out how to make mplayer repeat, so here make a stupid workaround with bash for. for (( ; ; )); do mplayer nicesong.flv; sleep 0.1; done Kill it by hitting ctrl+c two times [...]

Posted in Bash, for, mplayer, sleep | Hits: 66539 | 16 Comments »

what is your 10 common linux commands?

October 27th, 2007 mysurface

Dear command line ninjas, Mr CLI and keyboard pianist: What is your regular command you use? I am sure you must thinking of ls and cd. Yeah, they are common for every users, but how about the rest of them? I have construct a combos of commands to help you identify your top ten linux [...]

Posted in awk, column, Common, grep, head, history, nl, sort | Hits: 86531 | 36 Comments »

rm complains argument list too long

October 20th, 2007 mysurface

There is a limitation of rm command, where you can’t delete a large groups of files with *. For examples, rm -rf something* If there are large amount of files initiate with something, rm will fails and complains /bin/rm: Argument list too long. The solution is to make use of find, xargs and rm. find [...]

Posted in Common, find, rm, xargs | Hits: 47900 | 5 Comments »

fstab with uuid

October 10th, 2007 mysurface

When linux system starts, auto mounting partition will be done by refering to /etc/fstab. The file /etc/fstab will list down how you like the system to mount your partition. For examples, # <file system> <mount point> <type> <options> <dump> <pass> /dev/sda1 /media/sda1 vfat default,umask=077,gid=46 0 0 /dev/sda1 is the device, the number will be change [...]

Posted in Admin, blkid, ls, vol_id | Hits: 260446 | 71 Comments »

How to list just directories ( the correct way)

September 21st, 2007 mysurface

I have wrote a post stated that there are no direct ways to list just directories, and wrote a bash scripts using find to list the directories. I had made a WRONG statement. We can list just directories with ls -d, thanks to Ntropia who leaves me a comment. Before that I had tried hard [...]

Posted in Common, ls | Hits: 83796 | 19 Comments »

How to list just directories

September 19th, 2007 mysurface

There are no such direct ways to list only directories using the UNIX/ linux famous command ls. Anyway with command combo’s, we can achieve the goal in two ways shown as below. 1. use ls -l with grep 2. use find -type d ( The statement above is WRONG, check out the simple way to [...]

Posted in Bash, column, find, grep, ls, Text Manipulation | Hits: 98157 | 12 Comments »

Help yourself in man pages

September 17th, 2007 mysurface

To know more about a command, check for more options and maybe some examples how to use it, you need to read the manual of the specified command. To access the man page of particular command is easy, just do the line below. Let say I wanna access curl man page. man curl Or you [...]

Posted in Common, man | Hits: 40713 | 2 Comments »