How to open and close directories in the Linux terminal | Opensource.com

How to open and close directories in the Linux terminal

Learn how to use the cd command to change directories with this Linux tutorial.

Open a directory
Image credits : 

CC BY-SA Seth Kenlon

x

Subscribe now

Get the highlights in your inbox every week.

To open a directory on a computer with a graphical interface, you double-click on a folder. It opens, and you are now "in" that folder.

To open a directory in a terminal, you use the cd command to change your current directory. This essentially opens that folder and places you in it.

$ pwd
/home/tux

$ ls
example.txt
Documents
Downloads
Music
Pictures
Templates
Videos

$ cd Documents
$ pwd
/home/tux/Documents

Close a folder

To close a directory on a computer with a graphical interface, you close the window representing that directory.

You don't have to close directories in a terminal, but you can always navigate away from a location you've made your current directory. The cd command, issued alone with no arguments, takes you back home.

bash$ cd
bash$ pwd
/home/tux

 

List files on your computer

Learn how to use the ls command to list files in the terminal with this Linux tutorial.
People work on a computer server with devices

If your application isn't working—or you're just looking for more information—these 20 commands will come in handy.
4 different color terminal windows with code

Linux gives you the ability to choose the terminal interface you like—not one it imposes.

About the author

Seth Kenlon
Seth Kenlon - Seth Kenlon is a UNIX geek, free culture advocate, independent multimedia artist, and D&D nerd. He has worked in the film and computing industry, often at the same time. He is one of the maintainers of the Slackware-based multimedia production project Slackermedia.