how to transfer files over network using scp

linux cp command to copy folders

Secure Copy or scp is a command line utility that allows you to copy files and folders between two locations. These locations can be on the same machine, on different disk drives on the same machine or even on remote machines. The utility takes care of the security and permissions while transferring the files which makes it easier to copy…

bash: find last occurrence of a character in a string

linux count characters, words, lines

When writing shell scripts, you usually run into use cases where you want to manipulate text strings. Here we will see how you can find the last occurence of a single character in a string and then use that information to manipulate text or strings. For the purpose of this post, we will consider the character that we can to…

how to delete a folder or directory in linux

Linux command line delete files

The Linux command to delete a folder or directory is the same as the one to delete a file. You can use the rm command to delete both files and folders. Deleting an empty directory is easy enough but if you try to remove a directory that has files in them, you will get an error. deleting an empty folder…

how to search for text inside a file in the vi editor in linux

vi editor and search expressions

The vi or vim is a console based text editor in Linux. It is probably the most useful of Linux applications, in that you can quickly view and edit the text files right at the command shell. When viewing the text files, one of the useful features is the ability to search for a word or some text in the file….

how to use brace expansion characters in linux command line and shell scripts

brace expansion notation in linux command shell

If you are a Linux power user, you are probably working a lot with command shell both the command line interface (CLI) as well as shell scripts. Linux command line provides a lot of flexibility and powerful options when working with different commands: regular expressions, wildcards, meta characters, operators, file and i/o redirection, brace expansion etc etc. We will see…

what are linux commands and the 4 types of them

shell commands that are builtin to the shell

In Linux or any unix based system, a command refers to a directive that can used to invoke computer program. This program then acts as an interpreter to the command and its options and arguments, and performs a specific task. In most scenarios, a command refers to a directive in the command line which is usually a shell such as…

how to get current date and time inside a shell script

date and time in shell

When writing shell scripts, many times you would want to get the current time and date, that is the date and time when the script is getting executed. This value can be saved to a variable and used through out the script for various different purposes. You can use them to generate informative file names or even other variables. You can…

how to prompt for input from user in a linux shell script

shell script select command menu

When writing shell scripts, you will have scenarios you want to get input from the command line. And you would want to perform some specific action based on the user input. Programming a shell script to accept user input from the console is quite simple. We will see some examples of how you can do this in a bash script….

how to chain commands in linux command line (with examples)

sort command with redirection

Sometimes you would want to run multiple commands in succession or simultaneously. This is usually useful when running processes or commands that is expected to run for a long period of time. This allows you to automate a process that include several commands that may or may not depend on the result of the previous command. Linux command chaining is the…

12 useful bash aliases that can make you more productive in linux

bash aliases in linux

Aliases is one of the most useful features of Linux command shells. You probably end up using the same commands over and over on a daily basis. This is true if you use the command line for almost everything. You can use bash aliases (if you use bash) or shell aliases to make these every day tasks easier to execute. Most of…

how to call shell script (.sh) file from another shell script

Reload shell profile environment in linux

When writing or developing shell scripts in Linux, you might want to call or execute another script file from with in the current script. There are three different ways you can do this, and which method you want to use will depend on what your requirements are. Firstly, you need to know how exactly you want the other script to…