Basic Linux Commands

Basic Linux Commands

ยท

2 min read

Basic Linux Commands

pwd

Get the full path of the current working directory

pwd.png

cd

Navigates to the last directory you were working on

cd ~

Navigates to the current user's home directory

cd ..

Navigates to the parent directory of the current directory

cd ...png

ls

Lists the names of files and directories in the current directory

ls.png

ls -a

List all the files including the hidden files and directories (hidden files are those whose name starts with . )

ls -a.png

ls -l

Lists the files and directories in the current directory in long table format

ls -l.png

ls -ld dir-name

List information about the directory dir-name instead of its contents.

ls -ld.png

mkdir dir-name

Creates a directory with the name dir-name

mkdir.png

rmdir dir-name

Removes/Deletes the directory with the name dir-name

rmdir.png

Changing File Permissions

OctalDecimalPermissionLinux Representation
0000 (0+0+0)NO Permission---
0011 (0+0+1)Execution (NO Read and Write)--x
0102 (0+2+0)Write (NO Read and Execution)-w-
0113 (0+2+1)Write + Execution (NO Read)-wx
1004 (4+0+0)Read (NO Write and Execution)r--
1015 (4+0+1)Read + Execution (NO Write)r-x
1106 (4+2+0)Read + Write (NO Execution)rw-
1117 (4+2+1)Read + Write+ Execution (All Permissions)rwx

chmod file-name

Change the file permissions. Specifications

chmod -R dir-name

Change the permissions of a directory recursively. Mostly used to change the permission of a directory

Did you find this article valuable?

Support Prahlad Inala by becoming a sponsor. Any amount is appreciated!

ย