Linux Commands which we use daily

Linux Commands which we use daily

Ask any developer, and you will hear the same, switch your OS to Linux/Unix-based platform and switch to a terminal to have a better coding experience. But what we all forget is to share how daunting the whole migration strategy was for most of us.

I started using the command line heavily somewhere around 5 years back. And to be honest, it was such a painful experience because I would see my peers do stuff in a flick of a keystroke, while I would have to google the whole thing and then type it out, or worse, I would open GUI to do something which felt a bit complex. Back then I was someone who would be too lazy to learn new tricks from google because I was from a non-CS background and most people around me would be using GUI to do everything.

Fast forward 5 years, now being on the opposite side of the table, I advise every freaking person to switch to Linux and start using the terminal. But I also feel the pain which they would go through. So here are the top Linux commands which I feel should be enough for you to get things started.

  • ls - List all the content of the folder
  • ls -lart - List all the content of the folder with details
  • pwd - Gives us the absolute path on which you are currently in.
  • cd /abc/123 The most common command you might be using is, Change the directory to a particular path. This command will move you to an absolute path /abc/123
  • cd xyz - Suppose you are on the path /abc/123and then you use this command, then you will move into the xyz folder, your current path would be /abc/123/xyz
  • touch <file_name.extension> - You can create a file with the given name
  • vi <file_name.extension> - This is equivalent to a notepad, you can open any file and edit it. It is one of the most powerful tools you should learn ASAP.
  • rm -rf <folder/file> - (⚠️ CAUTION) Please do make sure you are clear on why you are trying to delete any file or folder since there is no looking back once you perform this operation. This deletes your folder/file forever from your system.
  • grep - Suppose you want to search some content in files, until now you would have to manually open every file and check the content of the file. But not anymore, grep is one of the most powerful commands which any developer should learn first. It helps in searching through millions of line log files in seconds.
  • cat <file_name> - Print the file content into the command line without opening the file.
  • cp -R <source_file_path_to_copy> <destination_file_path> - Copy file from one place to another
  • mv -R <source_file_path_to_copy> <destination_file_path> - Move file/folder from one path to another.
  • mkdir Create directory.
  • history If you have used a particular command in the past but can't remember it then you can type history,  it will show you all the commands you have used in the command line in the past.
  • Using history is fine, but it is also time-consuming, the alternative is, use reverse-i-search which is ctrl+R and then start typing the command which you were searching for but don't remember fully, you should be able to see the command showing up.
  • tail - Prints the bottom 10 line content from the file.
  • head - Prints the top 10 line content from the file.

Well I know these are too many commands for a person just starting, but TBH if you start using these commands then they would be muscle memory for you within 2 weeks.

Apart from using the above commands, I strongly recommend you to move to ohmyzsh terminal. This is one of the best terminals I have come across, and I wish I started using it early on.

Oh My Zsh - a delightful & open source framework for Zsh
Oh-My-Zsh is a delightful, open source, community-driven framework for managing your ZSH configuration. It comes bundled with several helpful functions, helpers, plugins, themes, and a few things that make you shout... OH MY ZSH!