Bash: Work with the Command Line on Linux System

This is an article, i will update, when i have another shortcut in my daily work on the console, which makes my life easier..

Today i needed a little help to remove „empty“ lines from a csv file. They were separated by comma, but when i opend the csv in LibreOffice, these lines were translated into empty lines. Correctly. With sed you can remove such line quickly:

sed '/^,*$/d'  > 

If you want to empty a file on the command line, use the following command:

:> 

Today i had the requirement to rename many *.html files to a consistent naming scheme, so i tried a bit with find to get a nice and smooth solution, have a look at this:

find . -type f -name 'fileName' -exec mv {} {}_renamed.tgz \;

# The Result should look like this:
-rw-r--r--  1 patrick.ott domainusers 1160404 Mär  4 11:51 fileName_renamed.tgz
-rw-r--r--  1 patrick.ott domainusers 1110818 Mär 24 14:48 newName1.tgz
...

If you want to get all PID’s from a running App on your System, try this:

# in this example i wanted to get all pids from the running apache
ps -ef| grep '/usr/sbin/httpd -f' | awk '{print $2}'

If you want to kill all pids

# in this example i wanted to get all pids from the running apache and kill them
kill $(ps -ef| grep '/usr/sbin/httpd -f' | awk '{print $2}')