There's more to learn about the 'cd' command. Lil' Linux Lesson!

preview_player
Показать описание
The "cd" command, "change directory", is a critical part of navigating in a Linux or UNIX based system.

In today's Lil' Linux Lesson, we'll dive into the cd command, some intermediate usage bits, and then speculate about some POSIX reasons why certain choices were made. We'll span the gamut from beginner to advanced in one video. I hope you enjoy!

This video was not sponsored - if you want to help me do more videos like this one, please help support the channel!

Chapters and whatnot:
0:00 How well do YOU know the cd command?
0:14 What does the cd command actually do?
0:51 Basic usage of the cd command on Linux
2:01 Going up the directory tree with the cd command
2:34 Going to a previous directory with the cd command
2:51 Navigating back to the home directory using cd
3:05 Navigating to absolute paths with the cd command
3:31 Want to know more about the cd command? Use the man builtins page!
3:42 Why isn't there a manpage for cd?

#linux #terminal #homelab
Рекомендации по теме
Комментарии
Автор

<-- This Linux n00b appreciates these Lil' Linux Lessons. This Amiga veteran appreciates the Workbench 1.3 cameo as well. ;)

LeftoverBeefcake
Автор

Don't forget the lovely functionality of hitting the TAB key while cd'ing around.. saves alot of typing

gentoolive
Автор

I've been using Linux since 2002 and I didn't know about "-". Yay learning! Linux is awesome, and so are you.

CronoCloudAuron
Автор

Was thinking.. oh cute the 'cd' command. I will watch for fun. And then BAM! Veronica hits me with the cd - It's been something like 42 years and I did not know (remember) that. Thank you!

JarrodMcKitterick
Автор

I missed the "...and so are you!" Part at the end😢❤ great vid. Always comforting to watch one of these

danielbrunk
Автор

Not related specifically to `cd`, but using Alt-. (hold alt, tap period) is fantastic when navigating the shell.
If I've just done `mkdir -p /some/long/path/name`, I can then go to the newly created directory by typing `cd `, pressing Alt-. to insert the last word of the last command, and then enter. If it's from several commands ago, I just keep pressing Alt-.

Then there's also `pushd .` and `popd` if you wanna get fancy.

james_neko
Автор

when I saw this video was published, I thought, "I'll bet I manage to learn something new". And I did. Never knew about "cd -". Awesome!

malfunction
Автор

Your videos have a @Technology Connections vibe. So comforting to watch.

nuclearnyanboi
Автор

here's a thing I tripped over in my early linux days: there has to be a space between "cd" and ".." unlike in DOS, where it works without the space. this may not be a common problem anymore though :)

posiputt
Автор

I totally never knew about man builtins, and I've been using this stuff for decades!

thatjpwing
Автор

One of the things that I both love and hate about Linux is that even though I've been using it for years, I still learn new things about even basic stuff all the time. I love that there's all that depth, but hate that it's all kind of secret knowledge. The only tip I would add to this, btw, is how helpful tab autocomplete can be when using CD. For example, if you were in ~/Downloads/songs/RockyHorror and wanted to get to Absolute Treasures but couldn't quite remember how to escape spaces, you could always type "cd Abs" and then the tab key and it'll complete all the escaping for you. Sure it's lazy, but it's also very very safe.

mausmalone
Автор

I made an mdc alias, which stands for make directory then change into that directory.
Very handy!

coolworx
Автор

Just a quick comment on the question raised at the end of why cd is a shell built-in. It's a function of the chdir system call. That system call changes the working directory of the process that calls it. But when running an external program, the shell forks a child process. So a chdir call made there would only change the working directory of the child, not of the shell process itself. As a result you can't really have an application program that changes the working directory of the interactive user, short of starting a new shell and killing the parent process. Another interesting tidbit is that the behavior of things like '-' and the '~' notation are actually implement in the shell, and not the kernel. I.e., you can't expect them to work if you write a program that calls chdir to change the directory the program is running in. On the other hand '..' is implemented in the OS and in most file system implementations is literally stored in the directory data structures on the disk. (Okay, that wasn't as quick as I intended.)

brianstuart
Автор

sudo pronounced as "Sue Dough" made my day. Any other way of saying it grates on my ears. Veronica is a treasure.

Thankzsharing
Автор

My favourite part of this video was when you said, "kind of like opening a different folder in a file browser." Amiga 😀

mcosta
Автор

This is great. Really appreciate how seriously you treat a topic that some folks would dismiss as being obvious. I grew up with DOS, but there are adults now that have only ever used a touchscreen. We all start somewhere, and some folks are most assuredly starting here!

ChrisHarringtonMinneapolis
Автор

Just found out this channel, and it has become one of my favorites so far

Healing_Coding
Автор

WOW! Love the explanation. You think you know linux 'CD' commands, but there is always something new to learn.
Thanks Veronica! Your Awesome.

david
Автор

Loving this channel. Can’t wait to see more videos about Linux and I’m just getting started learning it.

slightlyprofessional
Автор

That was very helpful because I learnt 2 new things in under 5 minutes so Thank You Very Much Veronica :)

jakejoyride