Top 20 + Important Commands with Examples - Basic Commands for Linux

 Creating files :

cat (Concatenate) command is used to create a file and to display and modify the contents of a file.

Example :



cat -> command is used to create a file.

file1 -> line is user mentioned a file name.




Ctrl+d (To save the file)

To display the content of the file :

# cat (filename)




To append the data in the already existing file :

# cat >> (filename)


Ctrl+d (to save the changes)

Creating multiple files at same time using touch command :

#touch (filename) (filename) (filename)

#touch file1 file2 file3



check the files use # ls command.





check the files permissions , user and group details use # ll command.






Creating a Directory:

#mkdir (dir name)

#mkdir folder1




check the files permissions , user and group details use # ll command.








Copying files into directory:

#cp (source filename) (destination directory)

#cp file1 folder1

#cd command is used to change directory.







Moving files from one location to other:

#mv (filename) (Destination directory)

#mvfile1 folder1











Moving a Directory from one location to another location :

#mv (dir name) (destination dir name)
#mv folder1 folder2












Renaming a File :

#mv (old name) (new name)

#mv file1 newfile1








Renaming a Directory :

Command for renaming the directory.

#mv (old name) (new name)

#mv folder1 newfolder1






Removing a File :

#rm filename

#rm file2






Removing an Empty directory :

#rmdir (dirname)

#rmdir folder2










Filter commands:

less:

less command can be used to read the contents of a text file.

#less





more:

more command can be used to read the contents of a text file.

#more





head:

head command used to show top 10 lines of a text file.

#head


tail:

tail command used to show last 10 lines of a text file.

#tail


Network in linux - TopLearnLinux

  Networking: It is a connection between two or more machines to communicate with each other. The basic requirements for Net...