Skip to main content

Basic Linux/unix Commands - Part 1


Basic Linux/Unix Commands - Part 1


Let we start the basic Linux/unix commands - part 1 

pwd Command

               1. The command pwd displays the current working directory. 

              2. Simply use the pwd command to determine your current working directories. 

Output
 According to the output, the current home directory .

cd Command
                1. cd command is used to navigate the directories. 
                2. For examples : Run the following command to go to the /var/log file path.

Output

               3. cd . . is used to get back one step form the current directory. 

               4. cd is used to get back to the home directory.


ls Command
                  The ls command is used to list existing files or sub-folders in a directory.

Output

   -a option is used to show the hidden files.

touch Command
              1. The touch command is used to create zero size file . 
syntax

             2. Run the following command to create a sample.txt file.
and use ls command to list the created file.

cat Command 

               cat command is used to view a specific file's contents .

syntax


mv Command 

                 1. To transfer or rename files, by using the mv command.



                 2. When renaming a file, you may not be alerted that it may overwrite an existing file. 

                 3. So, when issuing mv, always use the '-i' option as a precaution .


                 4. While moving the files, better to move more than 2 arguments like this,


                 5. If ~/Test already exists, mv will copy the files there. 

                 6. If it doesn't exist, an error notice will appear, like this, 


cp Command 

                1. The cp command is used to copies a file from one location to another location. 

                2. This command will be create duplicate file from original file. 

Syntax


                3. For examples, Copy the file sample.txt to the Public/docs/ directory


mkdir Command 

                 1. Use the mkdir (make directory) command to create a new directory.


                2. Let's make a new directory called project.


                3. Use the -p argument to create a directory within another directory as shown below. 


rmdir Command 

                1. The rmdir command is user to deletes a directory that is empty.

                2. To delete or remove the tutorial directory, for example, use the command


                3. If you try to delete a directory that isn't empty, you'll get an error message like the one below.


rm Command

                1. To delete a file, use the rm (remove) command. 

Syntax


                2. Example: Run the command to delete the file.txt file.


                3. Using the -R option, you can recursively remove or delete a directory.

                4. It's possible to delete an empty or non-empty directory also by using -R option. 



                5. Example: To delete the project directory, use the command




That’s It! In this topic, we have covered Basic Linux/unix Commands - Part 1











Comments

Popular posts from this blog

How to Check Hardware Details on Linux:

  Whether you're troubleshooting hardware issues, planning an upgrade, or just curious about your system’s specifications, Linux provides a variety of commands to gather comprehensive hardware information. Here are some essential commands: 1.  Use lscpu to get detailed information about the CPU, including architecture, cores, threads, and CPU speeds. # lscpu                                                 2. The lshw command provides a complete overview of hardware configuration, including CPU, memory, storage, and network. You’ll likely need superuser privileges to run it. # sudo lshw                                                                               ...

testing

09052025 T-1 { "volume_groups" : { "vgroot" : { "vgsize" : "304G" , "fs_type" : "xfs" } } , "logical_volumes" : { "root" : { "lvroot" : { "vgname" : "vgroot" , "lvname" : "lvroot" , "lvsize" : "12G" , "mountpoint" : "/" , "purpose" : "root filesystem" , "disk" : 1 , "partition" : 2 } } , "swap" : { "lvswap" : { "vgname" : "vgroot" , "lvname" : "lvswap" , "lvsize" : "4G" , "mountpoint" : "NA" , "purpose" : "swap" , "disk" : 1 , "partit...

How Virtual Machines are Created in OpenStack: A Complete Backend Workflow:

When creating a Virtual Machine (VM) in OpenStack, several components work together in the backend to provision the instance. Here's a step-by-step explanation of how the process flows: 1. User Request Interface Used : The user initiates the VM creation through the Horizon Dashboard (web UI), the OpenStack CLI ( openstack server create ), or the OpenStack API. Request Information : The request includes parameters such as: VM name. Image (the operating system or custom image to boot from). Flavor (the compute, memory, and storage specifications). Network (which network the VM will be connected to). Security Groups (firewall rules). Key Pair (for SSH access). 2. API (Nova API) Component : Nova (Compute service). Process : The request is received by the Nova API , which validates the request (checks if the requested resources like the image, flavor, and network exist). If valid, the API creates an entry in the database for the new instance. Nova's Role : Nova is the core service r...