Mount ssh filesystems under Linux or how I mounted my webspace into my root server

Today I had to mount a ssh filesystem under Linux. The reason was, that I had the perception that I would be a very cool idea, to use my old webspace package from all-inkl.com, that I only kept because of the 10 included domains, as a backup storage for my root server.The plan was to […]

Wipe a disk via Linux shell

This is how to wipe a disk via Linux shell:

The command above erases all data on the device /dev/sdc and overrides the data 2 times. Finally every bit is overridden by zeros. So in sum it takes 3 iterations to wipe a disk via Linux shell. n specifies the number of iterations taken place […]

Search query: list files containing a certain term

To get a list of files that contain a certain term for the current directory you can use this command to find the search query:

This shell command searches the current directory recursively (-r) and lists (-l) all files containing the search query SEARCHTERM. SEARCHTERM can also be a regular expression. Example result:

If you […]

Count search results on Linux shell

Lets imagine you want to search for a term in a file and you want to know, how often it can be found in the file. With this command combination you can count search results on bash:

This is how this way to count search results works: The input file is opened in less. Afterwards […]

Convert linefeeds for all files in a folder (CRLF to LF)

If you are working in teams using different operating systems, it could happen, that you get files with unsuitable linefeeds in it. For me as a Linux user the bad guys are normally CRLF’s (Carriage Return and Line Feed @see https://en.wikipedia.org/wiki/Newline). To just convert the CRLF’s in a single file to LF you can use the […]

Rename to lower case

To rename all jpg-files in a folder to its lower cased equivalent, you can run this little shell script:

The -v param of mv will only give you a list of renamed files.

Flatten directory structure

Recently I brought a mp3 player that wasn’t able to shuffle the track through all folders. That’s why I had to bring all tracks to the root directory of the player (flatten directory structure). I did it with the following command, that flattens the whole structure by searching all files in the structure and copying […]

Recursively set permissions

To change the permissions of all files and / or folders insight the current folder recursively you can run one of  the following command:

All options can be found on http://unixhelp.ed.ac.uk/CGI/man-cgi?find.