Here’s a quick overview of commands:

ls– lists a directory’s content.

pwd– shows the current working directory’s path.

cd– changes the working directory.

mkdir– creates a new directory.

rmdir– removes a folder or path.

rm– deletes a file.

cp– copies files and directories, including their content.

mv– moves or renames files and directories.

touch– creates a new empty file.

file– checks a file’s type.

zip and unzip– create and extracts a ZIP archive.

tar– archives files without compression in a TAR format.

nano, vi, and jed– edits a file with a text editor.

cat– lists, combines, and writes a file’s content as a standard output.

grep– searches a string within a file.

sed– finds, replaces, or deletes patterns in a file.

head– displays a file’s first ten lines.

tail– prints a file’s last ten lines.

awk – finds and manipulates patterns in a file.

sort – reorders a file’s content.

cut – sections and prints lines from a file.

diff – compares two files’ content and their differences.

tee – prints command outputs in Terminal and a file.

locate – finds files in a system’s database.

find – outputs a file or folder’s location.

sudo – runs a command as a superuser.

su – runs programs in the current shell as another user.

Chmod – modifies a file’s read, write, and execute permissions.

Chown – changes a file, directory, or symbolic link’s ownership.

useradd and userdel – creates and removes a user account.

df – displays the system’s overall disk space usage.

du – checks a file or directory’s storage consumption.

top – displays running processes and the system’s resource usage.

htop – works like top but with an interactive user interface.

ps – creates a snapshot of all running processes.

50 Linux Commands everyone should know to clear the Interview

uname – prints information about your machine’s kernel, name, and hardware.

hostname – shows your system’s hostname.

time – calculates commands’ execution time.

systemctl – manages system services.

watch – runs another command continuously.

jobs – displays a shell’s running processes with their statuses.

kill – terminates a running process.

shutdown – turns off or restarts the system.

ping – checks the system’s network connectivity.

wget – downloads files from a URL.

curl – transmits data between servers using URLs.

scp – securely copies files or directories to another system.

rsync – synchronizes content between directories or machines.

Ifconfig – displays the system’s network interfaces and their configurations.

netstat – shows the system’s network information, like routing and sockets.

traceroute – tracks a packet’s hops to its destination.

nslookup – queries a domain’s IP address and vice versa. Nslookup is used for handling

     DNS lookups and displays crucial information such as MX records, and the IP address

    associated with a domain name

dig – displays DNS information, including record types.

history – lists previously run commands.

man – shows a command’s manual.

echo – prints a message as a standard output.

ln – links files or directories.

alias and unalias – sets and removes an alias for a file or command.

Cal – displays a calendar in Terminal.

apt-get – manages Debian-based distros package libraries.

who: The ‘$ who’ command displays all the users who have logged into the system currently.

pwd : The ‘$pwd’ command stands for ‘Present working directory’ and as the name says, it displays the directory in which we are currently.

cd : The ‘$ cd’ command stands for ‘change directory’

touch : The ‘$ touch’ command creates a file

cp : This ‘$ cp ‘command stands for ‘copy’ and it simply copy/paste the file wherever you want to

 Chmod : The ‘$ Chmod’ command stands for change mode command. As there are many modes in   Unix that can be used to manipulate files in the Unix environment. Basically, there are 3 modes that we can use with the ‘Chmod’ command 
1. +w (stands for write and it changes file permissions to write) 
2. +r (stands for read and it changes file permissions to read) 
3. +x (generally it is used to make a file executable)

default permissions of file and folder in Linux: – rw-rw-r–

Click here to know How to make money from Facebook

Q. What are the default permissions in Linux?

A. Linux uses the following default mask and permission values:

The system default permission values are 777 (rwxrwxrwx) for folders and 666 (rw-rw-rw-) for files. The default mask for a non-root user is 002, changing the folder permissions to 775 (rwxrwxr-x), and file permissions to 664 (rw-rw-r–).

Cal : The ‘$ Cal’ means calendar and it simply display calendar on to your screen.

sort : As the name suggests the ‘$ sort’ sorts the contents of the file according to the ASCII rules.

grep : grep is an acronym for ‘globally search a regular expression and print it’. The ‘$ grep’ command searches the specified input fully(globally) for a match with the supplied pattern and displays it

lpr: The ‘$ lpr’ command send a file to the printer for printing.

passwd : The ‘$ passwd’ command simply changes the password of the user.

Q. What is SSH used for in Linux?

A. The ssh command provides a secure encrypted connection between two hosts over an insecure network in Linux

Click here to know How to Make money in your free time

Some more commands are:-

LsLists all files and directories in the present working directory
ls – RLists files in sub-directories as well
ls – aLists hidden files as well
ls – alLists files and directories with detailed information like permissions, size, owner, etc.
cat > filenameCreates a new file
cat filenameDisplays the file content
cat file1 file2 > file3Joins two files (file1, file2) and stores the output in a new file (file3)
mv file “new file path”Moves the files to the new location
mv filename new_file_nameRenames the file to a new filename
sudoAllows regular users to run programs with the security privileges of the superuser or root
rm filenameDeletes a file
manGives help information on a command
historyGives a list of all past basic Linux commands list typed in the current terminal session
clearClears the terminal
mkdir directory nameCreates a new directory in the present working directory or a at the specified path
rmdirDeletes a directory
mvRenames a directory
pr -xDivides the file into x columns
pr -hAssigns a header to the file
pr -nDenotes the file with Line Numbers
lp -nc
lpr c
Prints “c” copies of the File
lp -d lpr -PSpecifies name of the printer
apt-getCommand used to install and update packages
mail -s ‘subject’ -c ‘cc-address’ -b ‘bcc-address’ ‘to-address’Command to send email
mail -s “Subject” to-address < FilenameCommand to send email with attachment
One thought on “Basic Linux Commands for Beginners with Example”

Leave a Reply

Your email address will not be published. Required fields are marked *