Craft Your Own Linux Commands: A Beginner's Guide to Customizing Your Terminal :B9:
Linux is a powerful and versatile operating system, but sometimes remembering all the commands can be a bit overwhelming. What if you could create your own custom commands? In this guide, I will walk you through the process of creating your own Linux command by leveraging the principle that "everything in Linux is a file." Let's replace the ls
command with a custom command called "Dekhado."
Step-by-Step Instructions
Step 1: Check Your Current Directory
First, open your terminal and find out your present working directory using the pwd
command. Then, list the contents of this directory using the ls
command.
pwd
ls
Step 2: Navigate to the Binary Directory
Next, navigate to the binary directory where executable files are stored. Use the cd
command to change directories and then list the contents using ls
.
cd /bin
ls
Step 3: Copy the ls
Command
In this directory, you will find the ls
command. We will make a copy of this command and rename it to "Dekhado."
sudo cp ls Dekhado
Step 4: Remove the Original ls
Command
Now, for demonstration purposes, we will remove the original ls
command. Be cautious with this step as removing system commands can affect your system's functionality.
sudo rm ls
Step 5: Use Your Custom Command
You can now use your custom command "Dekhado" just like you would use ls
.
Dekhado
Step 6: Restore the Original ls
Command (Optional but Recommended)
To avoid any system issues, it's a good idea to restore the original ls
command. You can do this by renaming "Dekhado" back to ls
or by reinstalling the coreutils
package.
sudo mv Dekhado ls
Or, if you prefer to reinstall:
sudo apt-get install --reinstall coreutils
Conclusion
By following these simple steps, you can create your own custom Linux commands. This can be particularly useful for simplifying command usage or adding a personal touch to your Linux experience. Always exercise caution when removing or altering system files, and ensure you have proper backups or restore points.
Happy customizing!
Note:-B9 is blog post 9 of this series
B1 link :- khushalmalik.hashnode.dev/the-rise-of-linux
Make sure you subscribe to Newsletter and Do follow !!!!!!!
EVERYTHING IN LINUX IS FILE
The last Blog of this series
All the blog post of this series I have wrote was from the NetworkChunk and TrainWithShubham youtube channel etc....
#Khushal_Malik #Devops #Cloud #linux #CustomLinuxCommands #LinuxTerminalCustomization #CreateLinuxCommands #LinuxCommandLine #LinuxTutorials #LinuxForBeginners #LinuxCommandReplacement #LinuxBinaryDirectory #LinuxSystemCommands #LinuxCommandExamples #last
Subscribe to my newsletter
Read articles from Khushal Malik directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Khushal Malik
Khushal Malik
I am an Devops Cloud Eng. with 2 years of experience