Archive

Posts Tagged ‘bash’

How to remove all files generated by an extracted tar archive

December 24th, 2009 gg1 No comments

Often I use tar files downloaded from the internet, sometimes these files don't include a directory containing all other files and directories, so it's very tedious removing all files generated by the extraction, but I can use the following command to remove all the files generated:

# rm -f `tar ft file.tar`

Categories: Bash Tip & Tricks, linux Tags: , , ,

Using xargs to parallelize and speed up jobs.

December 8th, 2009 gg1 No comments

Often we look for new way to boost up our work, so we write a lot of code to perform jobs at high speed.
Sometimes the right way is the old way, specially if we need to do repetitive jobs. To do this kind of jobs we can use the xargs command, this command used in pipe with other commands can automate our jobs.
For example if we want to remove all C files from a directory and from all subdirectory recursively we can do the following:

Removing a type of file recursively.

October 11th, 2009 gg1 No comments

Sometimes during my work I need to remove a set of files from a big directory tree. For example when I develop a driver or an application and I want to distribute to my customers only the obj files and the documentation files (README.txt, INSTALL.txt, LICENSE.txt, Makefile ……) I need to remove all my source code (*.c and *.h), this is a very tedious task, but I can use the bash to do this task for me, and I’m quite sure that bash doesn’t forget any files.
 

Categories: Bash Tip & Tricks, UNIX TLC Tags: ,

How to produce a beep using built-in speaker from the command line interface?

October 2nd, 2009 gg1 No comments

On Windows systems (XP or Vista) you can play a beep using the Win32 MessageBeep operating system function.

rundll32 user32.dll,MessageBeep

On Windows platforms you can also use the following command:

echo ^G

You can obtain ^G by pressing together the control key and the "g" key on your keyboard.