Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

Brandon Wright
Brandon Wright

Posted on

     

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, andrm.

ls - it lists files and directories

I commonly usels 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 modeExit 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 iscd it changes your current directory. So you can use this inputingcd 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 modeExit 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 modeExit 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 modeExit 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 modeExit fullscreen mode

Thecode command isn't available unless you install VSCode, and thePATH option. This command allows you to open project folders, or files with VSCode.

rm - user beware

rm -rf my-project-folder/
Enter fullscreen modeExit 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 andfind; all very useful commands but I hardly use them. I hope my list of commands helps create interest in linux commands.

Top comments(0)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

Junior Full-Stack Web Developer
  • Location
    BC, Canada
  • Work
    Junior Full-Stack Developer
  • Joined

Trending onDEV CommunityHot

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp