Another 10 Commands of Linux

Another 10 Commands of Linux

Hey peps, Welcome back to my other blog, Will start now with another 10 Linux commands, which will be very useful for beginners who started their Linux journey

1. find

So, This find command mostly used to find particular files/folders based on pattern

find folder1 folder2 -name file.txt

this is the syntax find <path/folder to check> -name <filename> in the above command, it will find the name file.txt in those 2 folders

image.png

2. Hard link[ln]

Hard link is used to link files with the original file so even though the original file got deleted the pointed file[i.e linked file] will have the content of it Having some restrictions where we can't link to directories and external file system

syntax : ln <originalfile> <linkfile>

ln data.txt dataaccess.txt

image.png

3. Soft link[ln -s]

Soft link is a bit different, here we can link to other file systems and directories too

syntax : ls -s <original> <linkfile>

ln -s recipes.txt newrecipes.txt

image.png

4. cat

Cat is used to print the content of the particular file

Syntax: cat file.txt

cat file1 file2 > file3 Re directional operator, > is used to concatenate the multiple file's content into one file

cat file1 file2 >> file3 using >> we can append the content of multiple files into a new file

image.png

5. tar

tar is used to group multiple files into a single archive

tar -cf test.tar file1 file2 file3

image.png

to see what are all the archived files without extracting use

tar -tf test.tar

In order to extract use copy tar -xf test.tar

6. history

This command is used to see the past command we used in the terminal like from the start

history

and history buffer has a maximum of 1000 command entries and the history file is limited to 2000 entries

7. free

This command is used to display the free and used system memory

free
free -k
free -m
free -b

here,

free is used to display the free and used system memory

free -k is used to display the free and used system memory in kilobytes

free -m is used to display the free and used system memory in megabytes

free -b is used to display the free and used system memory in bytes

8. !11

This command is used to run the particular line of command again from the history buffer

!11
!21

9. du -h and df -h

du is used to show blocks allocated to individual files, whereas df is used to show blocks allocated in entire file system

du -h
df -h

10. user add and passwd

useradd command is used to add a new user and is used to set passwd for the particular user

sudo useradd "root"
sudo passwd "root"