Unusual linux commands can be very handy in several cases. Here are some of them.

Repeat the last typed command:

 

Display file-content like cat, but from upside down, can be achieved with tac (reverse cat)

 

Like to lookup in a dictionary file? Use look. Everything whats starts with the passed word will be shown.

 

Display time / date in bash screen on right upper corner. Continously!

 

 

Veröffentlicht unter linux.

You might have discovered strange characters in your email-subject like: Ã¼, Ã¤ or Ã¶, and so on?
That’s because you have sent them as UTF-8 and they are being interpreted as ISO-8859. Maybee the charters in the email’s body part are correct because you have already set a proper encoding! Well, the body and the subject needs a separate encoding. You can solve the problem by passing the subject string like below:

 

ffmpeg is a mighty tool for dealing with videos. Around the ffmpeg core is a rich ecosystem with video-editing related tools. First, we look at some handy examples to get a feeling how to deal with ffmpeg.

Converting different file formats

Getting basic information about a video is as easy as:

Converting an mp4-video to an avi-video with ffmpeg:

The quality of the output can be defined as well with a number between 1 (high quality) and 50 (low quality). If you output-video is an avi you use the -p parameter. If your output-video is mp4 you use the parameter -crf instead. Have a look at the exmaple:

Use ffmpeg to convert an input-video to an output-video and set the framerate (parameter -r) of the output video to 5 frames:

Scaling a video can be done with ffmpeg as well. Use the scale video filter. This filter has two parameters, notice that the second one is -1, this means that the scaling for the y-axis is proportional.

Changing colors by using ffmpeg video filters

Convert input video to a greyscale output video with ffmpeg (see the -vf videofilter parameter):

Convert input video to a sepia output video with ffmpeg:

Joining (concatenate) and cutting videos

Cutting video with ffmpeg is simple. You want to specify a start and end time to convert only a certain timeslice? No Problem. The parameter -ss 30:15 let the video start at 30 minutes and 15 seconds. The parameter -t 40 defines the length. Take care of the parameters orders. This example cuts a 40-second lasting piece and starts at 30 min and 15 seconds:

You can even join (concatenate) videos together with ffmpeg. Concat two avi-videos together can be done with this command:

Joining mp4-videos doesn’t work the before mentioned way. Here we first create some intermediate ts files and join them afterwards:

 

Caturing video from webcam with ffmpeg

Capturing video from a webcam with ffmpeg and store it in output-video.
(It is important to know the name of your webcam device. In my case, it is /dev/video0 under linux. You can research this with the command: ffmpeg -sources)

 

Some useful Linux terminal shortcuts. For increased proficiency on the shell.

CTLR + L               Clean-up the whole screen

CTRL + A               Move cursor to the beginning of the line
CTRL + E               Move cursor to the end of the line

ALT + ESC + .       display the last entered parameters

Read Linux Tutorial Part1, before you start here.

Commands you have head about in Part1 are:
whoami, hostname, uname, uptime, clear, pwd, cd, echo, ~ and ..

 

In the second part of the Linux Tutorial, we will learn about dealing with files and folders (directory).

First move to your home directory with (change directory):

Now let us create a directory, named „garage“, with the „make directory“ command:

You have created the garage directory, but you are still inside your home directory. Go into the garage directory with:

Notice,  that the „change directory“ is by far the most important command. You will see, that you will use this command very often.
In the next step, you go „one directory up“, so that you will be in your home directory again. This can be achieved with:

Don’t forget the space between „cd“ and the two dots. The two dots is a sign for the directory above. There is a top-level directory, called the root. There is no directory above the root directory. You can go there with:

Again, there is a space between „cd“ and the „slash“. If you are curious whats inside the root folder, type:

The list command, with the parameter „l“, shows you the directories content. Time to go back into our garage directory inside our home directory. Go there with:

The tilde (press Alt-key + tilde-sign) is a sign for our home folder. And we want to go inside the garage folder, which is inside our home folder. We create now a file called „mycar.txt“ and write „bmw“ inside this file. Here we go:

The echo command simply displays the word in quotes, in this case „bmw“. The > character redirects the result („bmw“) into the file, which came behind the „>“ sign. Btw: a single „>“ always create an empty file, even when the file already exists. When you want to attach something to a file simply use „>>“. Let’s look into the file:

We want to copy the file mycar.txt:

And now we want to attach something to our new file:

Check the content of our new file with:

And check the contet of our garage folder with:

 

Veröffentlicht unter linux.

How to find the windows version on the command-prompt (cmd)

For a more detailed output you can use:

 

These tutorials explain the Linux operating system (os) step by step. Starting with simple examples and getting more advanced each lesson.

The line where we type in the commands is called the prompt, the blinking something right to it is the cursor.

Lets show who is logged in:

And the hostname of the computer can be shown with:

As you can see, username and hostname are contained in the prompt.

If you want to know the name of the operating system, you can use:

How long the computer is up (not rebooted since) shows the following command:

Clear all the stuff on the screen with:

If you using the arrow keys (up and down), you can browse between the commands you already entered.

When you want to know in which folder you are, use:

It’s short for: print working directory.

Let’s go to your users home directory by typing:

At this location, all the files related to your current user are stored. You home-folder is a special folder. The tilde sign „~“ is a synonym for your home folder. Instead of typing „cd“ you can type „cd ~“ as well. When you’re in your home folder you can see the tilde in the prompt. The tilde sign is a variable. You can output its content to the screen:

Create a directory named garage withe this command:

mkdir is short for: make directory

Most important command of all is „cd“. It means change directory. With this command you can browse in the directory tree.
Let’s switch to the directory „garage“ you recently created by typing:

The prompt, by the way, also shows you in which directory you are. (So you don’t have to type pwd all the time)

 

If I want to go back in the directory-tree, like one level up, we use:

Don’t forget a space between cd and the two dots. The two dots are a symbol for the upper (superordinate) folder.

If you type the first letters of a command, try to press two times the tab-key, and the command will be completed.
This will you save lots of time and is one of the most useful ways to increase your working speed.

Linux Tutorial Part2 >>

How to get size of whole mysql-db?

SELECT Round(Sum(data_length + index_length) / 1024 / 1024, 1) „size“ FROM information_schema.tables GROUP BY „size“;

Veröffentlicht unter mysql.

If you want to search words that are not spelled correctly you can use mysql’s buildin SOUNDEX function:

 

 

Veröffentlicht unter mysql.