Important Linux Commands for general knowledge — 1

shrimali senevirathna
2 min readDec 9, 2020

The most possible reason to learn the commands is because there are some commands accessible only via shell that can control very complex operations on Unix/Linux and Windows machines. Here we are considering some important Linux commands that could help. It is categorized in to several instances where we can use them.

View Directories/content

Check the content on current directory

ls

You can view more details about the files, like ownership and permissions, by adding the flag -l to the ls command.

ls -1

To see the hidden files in the current directory

ls -a

To find out where you are in relation to the rest of the file system

pwd

To navigate to different directories

cd /path/to/other/direcotry

To check out the contents of a file

cat /path/to/file/file_name

Create new Folders

To make a new folder

mkdir dir_name

To make two or three folders

mkdir dir1 dir2 dir3

Remove Folders

To remove a directory

rmdir dir_name

To remove directories

rmdir dir1 dir2 dir3 dir4

Copy Files

To Copy a file to a specific directory

cp /home/user/source_file /home/user/duplicates/target_file

To copy multiple files

cp /home/usr/dir/{file1,file2,file3,file4} /home/usr/destination/

Move Files

To move one or more files or directories into a different location, or rename them to a new name

mv /home/user/source_file /home/user/moved_files/target_file

Search Files

To search through files for the occurrence of a string of characters that matches a specified pattern

grep -rw /home/user/Downloads -e “vacation”

Edit files

to open the Nano editor and modify an existing file, or create a new one

nano /path/to/existing/file

To save modifications to the file

Ctrl+O

To close and exit the program using

Ctrl+X

To get help using

Ctrl+G

To exit help mode

Ctrl+X

From Next Article, Create, Modify, and Remove File and Folder Permissions in Linux.Go here.

--

--