DEV Community

Jarret Bryan
Jarret Bryan

Posted on

Byte Size: Changing Habits with the Command Line

I think one of the more tangible elements of tracking my progress while being a coding beginner is tracking how my habits have changed in the most basic ways as I use my computer. My experience interacting with the UI of my computer has completely shifted relatively quickly.

Previously, I, like many users, adhered to the user experience of manually clicking through folders, dragging and dropping documents and folders, right clicking for copying and deleting materials, double clicking to open files etc. etc. I stuck with the GUI.

Dragging to the trash is now dumb

I don't have to do this anymore

Everything has shifted after discovering the terminal and learning some very basic bash commands.

Instead of clicking through folders and scrolling manually, I navigate through my file structures just using change directory command and using the "ls" bash command to see what files I'm looking for:

basic bash navigation

Using the command line for navigation has really streamlined my workflow. I end up memorizing file and path names (or at least what they start with), and I spend far less time navigating and resizing menus.

The bash shell seems to be a really powerful tool with a lot of capabilities I've barely begun to scratch the surface of - after all, it's not just for navigation.

Lifehacker has a really beginner friendly guide on getting used to the command line.

Top comments (3)

Collapse
 
ferricoxide profile image
Thomas H Jones II

ls is good for finding stuff when you basically know where the target "stuff" is. If you want real power, look at the find command.

  • Want to see all the files you've modified in the last 3 days? find <DIR> -mtime -3
  • Disk is getting full and you want to identify disused files for archival? find <DIR> -mtime +&lt;DAYS>
  • Want to know where various DVD images you downloaded got to? find <DIR> -type f -name "*.iso"
  • Want to find all files that are actually symlinks? find <DIR> -type l
  • Want to see what files have the world-write permission set on them? find <DIR> -perm /0002 -type f

The possibilities are near endless, especially once you add find's -exec built-in function or pipeline your find to other tools via xargs (e.g., find <DIR> -type f | xargs grep -l <STRING> will provide you a list of files that contain a given string).

Collapse
 
jaybeekeeper profile image
Jarret Bryan

This is incredibly helpful! Thanks so much, I'm going to try these out ASAP!

Collapse
 
belinde profile image
Franco Traversaro

"seems to be a really powerful tool"? A good half of your operating system is made of bash scripts! 😉