Day-2 Basics Linux commands

Day-2 Basics Linux commands

  • The Linux command is a utility of the Linux operating system. All basic and advanced tasks can be done by executing commands. The commands are executed on the Linux terminal. The terminal is a command-line interface to interact with the system, which is similar to the command prompt in Windows OS. Commands in Linux are case-sensitive.

Task: What is the Linux command to:

  1. pwd - Print work directory. Gives the present working directory.

No alt text provided for this image

2. ls -The ls command is used to list files or directories in Linux and other Unix-based operating systems.

No alt text provided for this image

3. ls -l -Type the ls -l command to list the contents of the directory in a table format with columns including.

No alt text provided for this image

4. ls -a -Type the ls -a command to list files or directories including hidden files or directories. In Linux, anything that begins with a . is considered a hidden file.

No alt text provided for this image

5. ls *.sh -List all the files having .sh extension.

No alt text provided for this image

6. ls -d */ -List only directories.(we can also specify a pattern).

No alt text provided for this image

7. cd path_to_directory -Change the directory to the provided path.

No alt text provided for this image

8. cd ~ or cd -Change the directory to the home directory.

No alt text provided for this image

9. cd - -Go to the last working directory.

No alt text provided for this image

10. cd .. -Change the directory to one step back.

No alt text provided for this image

11. cd ../.. - Change directory to 2 levels back.

No alt text provided for this image

12. mkdir  'directoryName' - To make a directory in a specific location.

No alt text provided for this image

13. rm 'fileName'/ rm -f 'fileName' - To remove and forcefully remove the file from a specific location.

No alt text provided for this image

14. rm/rmdir 'dirName'/ rm -rf 'fileName' - To remove and forcefully remove the dir/folder from a specific location.

No alt text provided for this image

15. touch '.fileName'/ mkdir '.folderName' -To create a hidden file/folder.

No alt text provided for this image

16. mkdir -p  A/B/C/D     -Make a nested directory

No alt text provided for this image
No alt text provided for this image

Thank you! for reading this article.

Happy Learning !

To view or add a comment, sign in

More articles by Deepak Patil

Others also viewed

Explore content categories