Discover user guides and manuals within your linux system

May 9th, 2008 mysurface

Do you realized that we can obtain a lots of user manuals and guideline documents from our system? There is a folder /usr/share/doc, you may find some useful docs already preinstalled by your distro. Those docs are in pdf or html format. I manage to find user manuals for valgrind, ipython, systemtap, boost etc. I [...]

Posted in Common, echo, find | Hits: 52143 | 2 Comments »

Generating Random numbers

October 27th, 2006 mysurface

We can obtain pure random (NOT pseudo-random) bytes from /dev/random. Linux kernel harnesses a good source of randomness from you. The random bytes in /dev/random is measuring based on the time delay between your input actions. so seems /dev/random provided random bytes, we need to turn the bytes into an integer so that we could [...]

Posted in Bash, echo, Misc, od, touch | Hits: 79646 | 9 Comments »

if … then … fi

October 13th, 2006 mysurface

if iis a basic programming checking for condition and reacts based on the condition, bash uses if to check for File integer String For checking the File, let say your file name is stored at $fn, and you wanna check the file is exist ? do this: if [ -e $fn ] then echo “$fn [...]

Posted in Bash, echo, if, Misc | Hits: 83259 | 7 Comments »

word count

September 17th, 2006 mysurface

Word count is a very common tools that used to calculate number of lines, words and characters. For example if I can do this echo “hello world.” | wc 1 2 13 The result indicate that there are 1 line, 2 words and 13 characters. You can output result separately, -c indicates characters, -w indicate [...]

Posted in cat, Common, echo, wc | Hits: 43648 | 2 Comments »

check for error number

September 1st, 2006 mysurface

Error or no success running a command always return a number, usually it will return 0 unless it occurs an error. To check what error number it returns, do this after command is done. echo $? To test this, simply ls something doesn’t exist, then it will return value 2. Sometimes, you can obtain the [...]

Posted in Developer, echo, perror | Hits: 21193 | No Comments »

Setting Environment Variable

August 29th, 2006 liewsheng

You may wonder how you knowing the hostname or machine type you are log in. Actually we have a lot way to do so, one of them is print out the environment variable set. How we can set this variable? export is the command used in bash shell, example: export VARIABLE_NAME=”any data you want to [...]

Posted in echo, export | Hits: 30608 | 1 Comment »