Skip to main content

Command Palette

Search for a command to run...

Day2: Basic of Linux

Published
2 min readView as Markdown

Day 2: we are going to learn the basic command of Linux.

Linux is a family of free and open-source operating systems based on the Linux kernel. Operating systems based on Linux are known as Linux distributions or distros. Examples include Debian, Ubuntu, Fedora, CentOS, Gentoo, Arch Linux, and many others.

Listing commands

ls option_flag arguments --> List the sub directories and files available in the present directory

Examples:

  • ls -l--> List the files and directories in long list format with extra information

  • ls -a --> List all including hidden files and directory

  • ls *.sh --> list all the files having .sh extension.

  • ls -I --> list the files and directories with index numbers Inodes

  • ls -d */ --> list only directories.(we can also specify a pattern)

Directoy commands

  • pwd --> print work directory. Gives the present working directory.

  • cd path_to_directory --> change directory to the provided path

  • cd ~ or just cd --> change directory to the home directory

  • cd - --> Go to the last working directory.

  • cd .. --> change directory to one step back.

  • cd ../.. --> Change directory to 2 levels back.

  • mkdir directoryName --> to make a directory in a specific location

Task:

Task#1: Check your present working directory.

To check our present working directory, we can use the following command depending on the operating system you are using:

The pwd command stands for "print working directory." When you execute this command, it will display the absolute path of your current working directory.

Task#2: List all the files or directories including hidden files.

To list all the files and directories, including hidden files, we can use the following command, depending on your operating system:

Let's break down the ls -a command:

  • On Linux and macOS, the ls command is used to list files and directories. The -a option stands for "all" and includes hidden files and directories in the output.

Task#3: Create a nested directory A/B/C/D/E.

To create a nested directory structure A/B/C/D/E, we can use the command line interface (CLI) or a terminal. Here's the command we can use:

Thank you .

More from this blog

Untitled Publication

34 posts