Enable a user to gain write permission when mounting

October 10th, 2006 mysurface

We need to perform mounting with root privilege, but after a simple mounting, we need to be root in order to write to the mounting point. This is the default for a simple mounting, check out more mounting examples here. But we can grant the mount point ownership to other user besides root. We can [...]

Posted in Admin, cat, mount, pipeline | Hits: 57862 | 2 Comments »

Regular expression with egrep and ls

October 7th, 2006 mysurface

egrep is actually same as grep -E, it interpret PATTERN as an extended regular expression. Therefore ESCAPE ( \ ) is not needed for certain symbol. ls is a common tool for listing file that matches the keyword. Regular expression (RE) is a very important and useful to manipulating strings and text. In this example, [...]

Posted in egrep, grep, ls, Regular Expression, Symbol, Text Manipulation | Hits: 81504 | 3 Comments »

Run multiple commands consequently

October 3rd, 2006 mysurface

By specified terminator ( ; ) like in C/C++ programming, you can run multiple commands consequently. We usually want to do this when we want to compile and install source code for certain packages. ./configure;make;make install Bash first execute the configure, then make , consequently will install the package. But bare in mind, bash have [...]

Posted in du, read, Symbol, terminator, while | Hits: 83854 | 6 Comments »

easily extract a column of data from multiple columns

October 2nd, 2006 mysurface

To extract a column of data from multiple column, we can use cut. Usually cut use to extract value from huge trace file or data file such as /etc/passwd. To extract all available user name from /etc/passwd, you can do this cut -d”:” -f1 /etc/passwd Cut extract value line by line, to put all into [...]

Posted in cut, Misc, pipeline, Text Manipulation, xargs | Hits: 85721 | 5 Comments »

xargs use stardard output as parameter for another command

October 2nd, 2006 mysurface

xargs is a command line of findutils package. It is not so common for new user, but it is a very useful tools, let me pick an example to show the usage. Bare in mind, xargs is a kind of combo command use together with other command through pipeline. I have a list of links [...]

Posted in cat, pipeline, Text Manipulation, wget, xargs | Hits: 59663 | 10 Comments »

Redirect stderr to stdout

October 1st, 2006 toydi

Very simple, just remember: 1 = stdout 2 = stderr In python, its unittest module loves to dump test results to stderr (rather than stdout). In order to pipe the results to less , you may need to redirect stderr to stdout: python eggtest.py 2>&1 | less To redirect stderr into a file: python eggtest.py [...]

Posted in pipeline, stderr, stdout | Hits: 127319 | 6 Comments »

generate and print a sequence of number

September 28th, 2006 mysurface

To generate a sequence of number we can use seq seq 1 10 With this it prints 1 to 10 line by line, because by default separator is new line, anyway you can check, do this seq -s” ” 1 10 Doing this it change new line to a single blank space. But that is [...]

Posted in backquote, cat, Misc, pipeline, seq, Text Manipulation, wc | Hits: 70256 | 1 Comment »

query using debian packaging manager

September 24th, 2006 mysurface

I am here to show you two examples of using dpkg to query package info. To know what deb package is installed, you can do this dpkg -l Usually we do this with grep, to filter only info that we are interested in, let say i want to know the packages consist of keyword gcc. [...]

Posted in Admin, backquote, dpkg, grep, pipeline, which | Hits: 42870 | 4 Comments »

check the file type

September 23rd, 2006 mysurface

A command file is a good tool to help you determine what file type of a file. To check for a file type simply do this file filename Let say i want to check the file type of command line update-rc.d, i can do this file `which update-rc.d` output: /usr/sbin/update-rc.d: perl script text executable Uses [...]

Posted in backquote, Common, file, which | Hits: 28580 | 2 Comments »

get to know which command use to trigger the GUI program

September 9th, 2006 mysurface

If you are light weight windows manager user which depend on certain desktop such as kde, gnome, sometimes you want to know what is the command that call a particular program that you usually click with your mouse in kde/gnome, so that you can run it in console or trigger with key mapping. You can [...]

Posted in grep, pipeline, X11, xprop | Hits: 31018 | 1 Comment »