My most used bash commands...

framedoubt

Brandon Wright

Posted on March 11, 2022

My most used bash commands...

Hello devs

Knowing how to use a bash command, is a very helpful skill to have as a web developer. So lets start with the list of my favorite commands, which are: pwd, ls, cd, touch, mkdir, code, and rm.

ls - it lists files and directories

I commonly use ls without any options, this returns a list of directories and files in your current directory. You can also use this command to list directories and files of a given directory, see below:

ls my-directory/
Enter fullscreen mode Exit fullscreen mode

pwd - you are here (this is my exception)

I think it's important for you to know where you are, to get where you're going, and that's what this command does it prints your current directory.

cd - time to travel

You can't get anywhere if you have nothing to get you there, and in the linux file system your car is cd it changes your current directory. So you can use this inputing cd and the directory you want to navigate to, alternatively two dots will bring you to the parent directory of your current directory, see below:

cd new-working-directory/
cd ..
Enter fullscreen mode Exit fullscreen mode

It's important to note that you can use a feature built into bash, which tries auto-complete your input, when you hit tab.

touch - write to disk please

touch my-new-file.txt
Enter fullscreen mode Exit fullscreen mode

This command allows you to create a file, it's cool because it allows you to choose the file extension. The file extension is the part that comes after the dot, it commonly tells the file system which application to use to open the file.

mkdir - it's like a folder

mkdir my-new-director
Enter fullscreen mode Exit fullscreen mode

This command creates a directory labelled with the given text. Use directories to organize files and folders, in your projects.

code - batteries not included

code my-project-folder/
Enter fullscreen mode Exit fullscreen mode

The code command isn't available unless you install VSCode, and the PATH option. This command allows you to open project folders, or files with VSCode.

rm - user beware

rm -rf my-project-folder/
Enter fullscreen mode Exit fullscreen mode

This command can be used to delete a directory or a file, with the -rf option it deletes all directories and files within the given directory.

The end of the beginning

This is my first blog post, my hope was to provide a list of commands that I commonly use. My intent was to help people find somewhere to start with bash and test out the usage of file system commands. There are many other commands that I could have covered like, clear, cp, mv and find; all very useful commands but I hardly use them. I hope my list of commands helps create interest in linux commands.

💖 💪 🙅 🚩
framedoubt
Brandon Wright

Posted on March 11, 2022

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

My most used bash commands...
webdev My most used bash commands...

March 11, 2022