Tag Archives: bash

Bash: Get IP and IPv6 address and interfaces.

First use this commands to see your IP and IPv6 address and interfaces.

Now if you want to use this every day, just open your .bashrc file from your home folder.
Add this functions to the .bashrc file:

Now open a new terminal shell and use it:

Posted in All, Bash, Linux, Programming. Tagged with , , , , .

Bash: Changing extension to multiple files

To change file extension from *.txt file to *.text file use this command into your shell:

Posted in All, Bash, Linux, Programming. Tagged with , , , , .

Rename multiple files by cutting first part , the end or in middle of name under Linux – part 001.

You can see the images I make with Screenshot application and is named like :

When you want to rename multiple files recursively is very good to know how is finally format name.

It’s tree way to deal with this issue.

First you can cut the first part , the end or in middle of name.

Let cut first part in the named files. In this example I will remove : Screenshot – 10272013 – .

The next command will cut first 24 letters from the name of files.

Let’s see the output of this command:

Now I will cut the last 4 letters from the names of the files:

… and output will be :

Now you don’t use in command this:

… because you dont have now the .png in your names of files.

When you want to rename file in middle of name the you need something new.

Using the sed command to solve this issue:

You can see I change somethig from :

in this :

“$(echo $my_file | sed ‘s/ AM/ PM/g’)”

This will change the second from args of mv command into you want.

In this case will replace ‘ AM’ with ‘ PM’…

Sed also can change the special characters… Let’s remove the colon : with nothing.

… and the result of this command:

Posted in All, Bash, Commands, Linux. Tagged with , , , , .

Show all big files using find command in current directory.

Open your terminala and type this command:

This will show you all big files that are are greater than 100 Mb.

Also you can open .bashrc file and create this function.

Restart your terminal.

Now just use size with one argument of the size files.

Posted in All, Bash, Commands, Linux. Tagged with , , .

Using grep and many commands under Android OS .

The BusyBox combines tiny versions of many common UNIX utilities into a single executable.

You can find this command under android os.

Using busybox is simple. The first argument is taken by busybox and it’s applet executable.

For example if you want run dmesg with grep command then use this:

All applets include:

You can read more about this here.

Posted in All, Android, Bash, Commands, Linux. Tagged with , , , , .