Useful Linux Commands

2 minutes read

Linux_logo_errorbits.com

Here is a list that contains one of the most used Linux commands, and a short explanation for them: ls – list – lists files and directories, can be used with a lot of options like: -a, -R, -l, -g, -r;

pwd – print working directory – shows the path of the current directory;

ifconfig – interface configuration – used to view and change the configuration of the network;

cd – change directory – used to change the current working directory;

df – disk free – must be used with -h option(the values will be displayed in KB/MB/GB);

du – disk usage – must be used with -h option, -s option will sum the subfolders and files capacity;

grep – global regular expression print – processes text line by line and returns the value that matches the request;

cat / tac – catenate – is the simplest way to display the contents of a file, directly in command line interface / tac reverses the order of the contents;

tail – outputs the last part of the contents of a file;

tee – used to dublicate input and to route it to multiple outputs at once;

touch – used to update the access and modification time of a file, if the file does not exist it is created with the specified name;

mkdir – make directory – used to create directories;

rm – remove – used to remove/delete files or directories;

cp – copy – used to make copies of files and directories;

less – is a simple command line file viewer;

head –  used to display the first part of files;

file – used to determine the file’s type;

wc – word count – counts the words in a file / -m counts characters / -l counts lines;

ln – link – creates links between files;

find – searches the file system for the specified file;

locate / slocate – it searches in a database, it’s faster than “find” but not that accurate;

yum – used to install/remove packages, update/upgrade system (CentOS);

apt or apt-get – used to install/remove packages, update/upgrade system (Ubuntu);

whoami – shows the current user username;

who – shows the list of usernames;

uname – displays the operating system type, -a switch can be used for more details like distribution/version/kernel/release;

less /proc/cpuinfo – shows CPU hardware information;

cat /proc/meminfo – displays used and free memory information;

[updating with new commands…]

Facebook Twitter LinkedIn Telegram Whatsapp Pocket

Related Posts:

Many Linux commands deal with sensitive data like system hardware, passwords or operate under exceptional circumstances. Prevents regular users from executing these commands by mistakes and helps to protect data and system integrity. By logging in as root enab...
To read the last N lines of a file in Linux, you can use various commands and techniques. Here is how you can do it:Using tail command: The tail command allows you to display the last N lines of a file. Open the terminal and type the following command, replaci...
Before you start this tutorial is better to know how to get help and details about the commands, when you need it. There are several ways to get help about the commands, but I will present only the most important ones: Using –help as argument for the command E...
To install Golang in Kali Linux, you can follow these steps:Open the terminal on your Kali Linux system. Download the latest stable version of Golang from the official website. You can use the wget command to download it directly from the terminal. For example...
To read a file in the Linux terminal, you can use various commands depending on the type of file and your requirement. Here are some commonly used commands:cat: The 'cat' command is used to display the entire contents of a file directly on the terminal...
To display the contents of a file in Linux, you can use the following commands:Using cat command: The cat command can be used to display the contents of a file in the terminal. Simply type cat followed by the file name and press Enter. For example: cat filenam...