The !! bash trick: Insert the last used command

There are a few bash shortcuts (tricks), that make my life easier every day. One of my favourite bash tricks is !! . !! relaunches the last used command. The benefit of the !! is that it can be combined

How to display file and directory sizes in Linux and Unix

Displaying the size of a directory or file is an easy task in Linux and Unix. There are a few tools that do that: du, ls -lh, tree, etc. The du command is the most used for displaying sizes. How

How to change the hostname in Linux and FreeBSD

Changing a Linux / FreeBSD hostname is an easy task. The hostname can be changed temporary or permanent. In this article, I will show you how to set a different hostname in the most used Linux distros and FreeBSD. How

How to use “less” efficiently

The Linux / Unix less and more tools are called pagers. The pagers are used for navigating through text files and commands outputs. In this article I will show you some less shortcuts (tricks) that will make your navigation easier:

How to use variables in shell scripting

In this article I will show you how to create variables and set values to variables. This is an easy thing to do, but very important in shell scripting. I will use echo to display the variable values. How to

How to lock and unlock a user account in Linux

When you need to forbid a user to login the Linux system, you lock that user’s account. There are a few ways to do that. The simplest way to lock a user is with the passwd command. Without any option,

How to set and use the Linux CDPATH variable with bash

The CDPATH is an environment variable, just like PATH. It is used to cd directly in the folders you add in your CDPATH. By default, your CDPATH is empty but you can easily set it, as you like. Difference between

How to manipulate timestamps in Linux / Unix

The Unix / Linux touch command modifies the files and directories timestamps. If the file does not exist, touch creates it with the current timestamp. How to display file/folder timestamps: I will use stat to display the access, modify, and

The Linux / Unix stat command

The Unix / Linux stat command displays information about files and folders. Used without any option, the stat command displays the same info as ls -l, but nicer structured. But stat can be customized to display only the information you

The bash shell shortcuts

The Linux / Unix bash shell is very kind with the users. It offers some shortcuts that can really save its users day. In this article I will make a list of bash shortcuts usefull for editing commands: Jump to



Subscribe to get the latest Linux news and how to guides directly on your e-mail!