Add Timestamps Using the Ts Command In Linux

It can be useful to add current timestamp to each of the lines in files through the Linux command-line. ts (timestamp input) is a handy utility and a part of moreutils package in Linux which does just that. With ts, you can pipe the input file and directly add timestamps to each of the lines. This example uses Linux Mint to show how to use ts. Installing ts: First, install ts as it is not installed...

Quickly Create Multiple Directories And Files With Common Terms Using Linux Command Line

Creating multiple files and directories that have common terms or patterns can be done quickly from the Linux command line. For this, the braces {} are useful. Multiple directories with common terms: Example: To create directories named DailyReport2020, WeeklyReport2020, QuarterlyReport2020, MonthlyReport2020 and YearlyReport2020, there is no need to use mkdir command separately for each of them. Instead,...

Use Look Command To Search For Lines From Linux Terminal

If you want to search for lines that start with a specific string / words, then look command will be useful. (There are other useful Linux command line tools like aspell that can check for typos which are easy to use and quick.) Also unlike using grep to find instances of specific words, look is used only for finding lines that begin with a specified string or letters. Using it is simple, open...

Delete Files And Folders From Linux Mint Command Line Without Using rm

If the rm command when using Linux Mint Terminal is something that is scary (quite rightly so because of rm -rf), then there is a safer alternative to deleting files and folders without worrying about messing up the system. This is by using trash command. It works similar to recycle bin although from the command line. First, install it from Terminal in Linux Mint/Ubuntu : sudo apt install...

Type Less By Using The History Feature In Bash Shell To Recall Previous Linux Commands

Bash shell has a robust history feature which makes it easy to keep a track of previous commands that can be run again whenever needed. So if you spend a lot of time with Linux commands, this can save time by not entering same commands over and over. Seeing previously used commands: To get a list of previously used commands, from the shell/Terminal type: history This will show all the commands as...