Good job DT I was taught this years ago by a fellow developer, made navigating linux SO MUCH EASIER. I have found that almost nobody knows about pushd and popd. My OS does not have a man page for either one.
Since 'pushd' and 'popd' are shell built-ins, they may or may not be mentioned in the bash manpage. Or in the zsh manpage. If using fish, they do have a manpage for 'pushd' and 'popd.'
@@DistroTube Cool Thanks :) Makes sense. I actually just heard that they are shell build ins from your video, now I know why they may not be in the man pages with their own entry.
For ZSH, Check `man zshbuiltins` for a humongous manpage going over pretty much every ZSH built-in command a user would invoke interactively directly (other manpages like `man zshzle` and `man zshmodules` exist for other stuff).
I have been using popd/pushd for years. Maybe a decade. It is IMHO one of the most neglected shell commands. It really works with the worklow of doing most things on Linux.
It's a directory stack but the directories are not static. You can still change directories, with cd, without altering the stack. So it would be more accurate to say it's a stack of *working* directories. Also it's a stack so it should be used as such: you typically don't need to jump deep in the stack. That mechanism is useful when you need to work somewhere else in the filesystem before resuming your work. If you do that recursively the stack gives you an intuitive way to track what you're doing. It's often more convenient than opening a new shell every time because if you do that you can forget the hierarchical structure of your work. With a stack, it's obvious. Like say you want to compile a program A and you realize it depends on B. You push a directory where to extract B's source code. You compile it, which may require you to cd into its build directory or something. Then you realize B depends on C. So you push an other directory and so on. Each time you finally manage to 'make install' you pop the directory stack and you keep going.
I checked out fish my problem with it is I do a lot of yocto and buildroot. Fish does not play nice there and it becomes a productivity problem. Zsh really fills everything I like about fish without being difficult to use for things I am constantly using in my workflow.
This channel has two playlists about that, one is **Shell Scripting** and the other is **The Command Line**. I can't post the links because you will delete them anyway.
I could see those being useful in scripting, but for the interactive shell I'll stick to cd. Bash has the "-" argument to go to the previous directory. Between -, .. and tab completion, they do what I need. I am a simple man.
> Bash has the "-" argument to go to the previous directory. While 'cd -' is neat and I use it all the time, it just changes to the last directory (not necessarily the previous in the stack). So if you 'cd -' repeatedly, you just go between your current directory and the last one. 'prevd' and 'nextd' keep going through the directory history.
@@DistroTube Yes, whichever directory you were in last. What can I say? I'm a simple guy with simple needs. The fish "arrow traversal" feature looks great though. No need to think or count with that. It's like they were thinking of me.
Jeebes I've just learned df for btrfs free space when lsblk doesn't like root space left and here's a few more. Linux has so much goodies you'll never stop learning. Finally mares new user and ran the dtos script, really like it but no keybindings like arco does meta+f1-12 or am I wrong?
For Btrfs, don't use `df` from the system, use `btrfs filesystem usage`. Normal tools don't understand CoW, and can easily show you more than 100% disk usage.
The first time I saw somebody explaining this commands (pushd and popd) on UA-cam was in the channel "Joe Collins". He's back. The video about partitioning USB's was great. Maybe you can do something in the terminal but deeper (sorry, I don't speak english well :'v)
I did some research if this is really the case, since I've also heard this before. It looks like that that acronym was invented long after /usr first appeared. It looks like decades ago on Sun workstations it was really meant to be a short for "user". Later after it's original purpose change a bit, people start calling it "Unix System Resources". So I would say both is correct. Fun fact its that Debian (haven't checked other distros) and the Unix Filesystem Hierarchy Standard are calling /usr "second major section of the filesytem, /usr is sharable, read-only data". So no acronym at all, so it could also mean u=user s=shared r=readonly :D I've also checked my Linux book from 1996 and they say its "everything related to the user".
That's an awesome command, been using linux for 20 years now and never come across it. You learn something new everyday.
Good job DT I was taught this years ago by a fellow developer, made navigating linux SO MUCH EASIER. I have found that almost nobody knows about pushd and popd. My OS does not have a man page for either one.
Since 'pushd' and 'popd' are shell built-ins, they may or may not be mentioned in the bash manpage. Or in the zsh manpage. If using fish, they do have a manpage for 'pushd' and 'popd.'
@@DistroTube Cool Thanks :) Makes sense. I actually just heard that they are shell build ins from your video, now I know why they may not be in the man pages with their own entry.
And there it is, I use zsh and it is in the man page zshbuiltins, thanks again DT.
For ZSH, Check `man zshbuiltins` for a humongous manpage going over pretty much every ZSH built-in command a user would invoke interactively directly (other manpages like `man zshzle` and `man zshmodules` exist for other stuff).
I have been using popd/pushd for years. Maybe a decade. It is IMHO one of the most neglected shell commands. It really works with the worklow of doing most things on Linux.
I've used pushd and popd for years, but I didn't know about dirs. Thanks, learned something
I wish I knew this waaaaaaay before, Thank You DT
more tricks like this please.
Your command prompt looks fantastic.
Could you please share any details of how to configure mine in a similar way.
wow that worked in powershell somehow!!!! but only as an alias not all the fancy stuff
Thanks DT another cooel post.
It's a directory stack but the directories are not static. You can still change directories, with cd, without altering the stack. So it would be more accurate to say it's a stack of *working* directories.
Also it's a stack so it should be used as such: you typically don't need to jump deep in the stack.
That mechanism is useful when you need to work somewhere else in the filesystem before resuming your work. If you do that recursively the stack gives you an intuitive way to track what you're doing. It's often more convenient than opening a new shell every time because if you do that you can forget the hierarchical structure of your work. With a stack, it's obvious.
Like say you want to compile a program A and you realize it depends on B. You push a directory where to extract B's source code. You compile it, which may require you to cd into its build directory or something. Then you realize B depends on C. So you push an other directory and so on. Each time you finally manage to 'make install' you pop the directory stack and you keep going.
it's LIFO
@@ran_red Exactly. Like a stack.
@@ran_red I stand corrected.
Great video, learned new things. Can someone tell me which terminal application DT uses here? And how can I make my terminal look so nice?
I believe he's using the alacritty terminal with the qtile window manager.
Now that's hella interesting! Thanks
this is awesome content!
I checked out fish my problem with it is I do a lot of yocto and buildroot. Fish does not play nice there and it becomes a productivity problem. Zsh really fills everything I like about fish without being difficult to use for things I am constantly using in my workflow.
FYI it's the same in tcsh as well. ALthough I hardly use it; I'm mostly in vim so navigating is in there.
I've been using Unix for 30+ years. How did I not know of this?
My body wants to refuse this, but I'm afraid it will win in the end.
Can anyone recommend any guide for beginners to learn about shell command
This channel has two playlists about that, one is **Shell Scripting** and the other is **The Command Line**. I can't post the links because you will delete them anyway.
As a greek (cypriot) speaker, i find myself giggling like a 12 year old everytime i hear “push d”😂
I could see those being useful in scripting, but for the interactive shell I'll stick to cd. Bash has the "-" argument to go to the previous directory. Between -, .. and tab completion, they do what I need. I am a simple man.
> Bash has the "-" argument to go to the previous directory.
While 'cd -' is neat and I use it all the time, it just changes to the last directory (not necessarily the previous in the stack). So if you 'cd -' repeatedly, you just go between your current directory and the last one. 'prevd' and 'nextd' keep going through the directory history.
@@DistroTube Yes, whichever directory you were in last. What can I say? I'm a simple guy with simple needs. The fish "arrow traversal" feature looks great though. No need to think or count with that. It's like they were thinking of me.
Jeebes I've just learned df for btrfs free space when lsblk doesn't like root space left and here's a few more. Linux has so much goodies you'll never stop learning. Finally mares new user and ran the dtos script, really like it but no keybindings like arco does meta+f1-12 or am I wrong?
For Btrfs, don't use `df` from the system, use `btrfs filesystem usage`. Normal tools don't understand CoW, and can easily show you more than 100% disk usage.
fish
Array stacking at bash ;)
😀 👌 👍
The first time I saw somebody explaining this commands (pushd and popd) on UA-cam was in the channel "Joe Collins". He's back. The video about partitioning USB's was great. Maybe you can do something in the terminal but deeper (sorry, I don't speak english well :'v)
Havoc!
Is it just me or does everyone notices DT pulling his nose time and again. LOL.
Interesting but in my case, largely unnecessary, perhaps in a customized shell script
GVDT
👀 this exists?
Fish is so stupid..!
FIRST!
wow first???????
"/usr" does not mean user. It means Unix System Resources and therefore it is incorrect to pronouce it as user.
I did some research if this is really the case, since I've also heard this before. It looks like that that acronym was invented long after /usr first appeared. It looks like decades ago on Sun workstations it was really meant to be a short for "user". Later after it's original purpose change a bit, people start calling it "Unix System Resources". So I would say both is correct.
Fun fact its that Debian (haven't checked other distros) and the Unix Filesystem Hierarchy Standard are calling /usr "second major section of the filesytem, /usr is sharable, read-only data". So no acronym at all, so it could also mean u=user s=shared r=readonly :D
I've also checked my Linux book from 1996 and they say its "everything related to the user".
Haha and that old book also says that /usr were /home on old Unix system, which iirc was really the case.
"no way to supress the output" `pushd /usr/share/themes > /dev/null` You can "Alias" this with a bash function.