Get a filename only list of files in a folder

To get a list of all files in a folder without path, you can use the following snippet:

Example result:

Prefix files: If you want to prefix files, you can use the same command too:

Example result:

 

Remove all files and folders including hidden files on bash

To remove all files and folders including hidden files such .gitignore, .htaccess, .git etc. on bash you can use the following command:

Is the same as:

But ever shorter. ūüėČ

Split webm files into chunks on Linux

Today I had to split webm files into chunks on Linux.¬† The reason was, that I recorded¬† a screencast for a documentary. Therefore I used the Nimbus Chrome Browser Plugin (https://nimbus.everhelper.me/screenshot.php). The problem was, that the resulting video files in webm format were much to big to upload them to our Confluence Wiki. That’s why […]

Get file encoding via Linux shell

To find out which encoding a certain file has, you can use the file command on Linux shell:

Output example:

 

Rename multiple files on shell

To rename multiple files in the current folder, you can use the following command:

In this case, I had a bunch of files that I had to rename temporarily. They all started with Scheldon_ and had the fileending .xml. The snippets above first rename these files to Scheldon_SOMEWHAT.xml_bkp and then back to the original name Scheldon_SOMEWHAT.xml.

Formatted CSV output on Linux shell

If you want to output a CSV file on Linux shell, you could just open it with less, cat or nano (un-formatted CSV output):

The problem with this approach is, that you will get an unformatted ugly chunk of characters¬†like that: A much better way is it, to use the less command in combination with […]

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.

Deleting multiple lines with nano

That’s not as easy as you might think with¬†nano. Mainly because of the stage keystroke-philosophy of nano. Here is the way I cut out multiple lines, whole paragraphs or also huge text blocks with nano (Xubuntu 14.04, MacOS X 10.9.5). Open file in nano:

-c shows line-numbers. Alternatively you can press CTRL+C when you […]

Batch resize images with ImageMagic

Recently I had to reduce the size of many images for uploading ¬†them to a website. Unfortunately I didn’t find any tool like IrfanView¬†on Ubuntu, which I’ve used for such problems in my Windows days. But there is a much smarter¬†way to batch resize images on Linux. You simply can use the convert command from […]