It's six letters. Can't they just call it zd or something? Yeah sure, I can use aliases, but why complicate in the first place?
The command is 'z'
This is most probably a distro-specific aliasing. Tried it on Guix, it does not work:
$ z
bash: z: command not found
$ zoxide
zoxide 0.9.2
....
It's in the official docs for zoxide, you are supposed to use the z alias, and many distros just set it up directly like that. I love doing z notes from wherever I am.
That doesn't require a separate package, especially one which uses eval on every new shell. And isn't messing with my distros or personal aliases (and doesn't introduce cargo-packaging).
Simply adding one to two (you get the gist) directories and a keybind for cd .. is more slick.
There are cases where you might use pushd . but even then other tooling should already cover your needs.
It's also so easy that you can temporarly append to $CDPATH for a specific session.
But again, then a second pane or pushd is already available.
Now downvote me, lemmy.
On arch the command is just z
Hm I wonder, is it really a command? I thought it is just a function of the shell to change the working directory.
A command is anything you execute in the shell.
cd is just a built-in command
sudo !! to rerun last command as sudo.
history can be paired with !5 to run the fifth command listed in history.
Fifth as in fifth most recent command or fifth oldest?
I believe it's the fifth oldest - I think!-5 will get you the fifth impost recent, but I was shown that and haven't put it into practice.
The most common usecase I do is something like history | grep docker to find docker commands I've ran, then use ! followed by the number associated with the command I want to run in history.
Since nobody has said yet, I use screen pretty heavily. Want to run a long running task, starting it from your phone? Run screen to create a detachable session then the long running command. You can then safely close out of your terminal or detach with ctrl a, d and continue in your terminal doing something else. screen -r to get back to it.
I would know this as tmux, is there a difference?
no, tmux is a newer screen. some of us havent switched cos we're too lazy i guess? i think the common wisdom is that it's better. i havent tried cos i already know enough of screen and it's fine for me
Or you can learn both and spend the rest of your life trying screen commands in tmux and vice versa.
mmmmmm <3
gnu screen is just a different program than tmux. they do the same thing though
Also, screen can connect to an UART device or serial or anything that offers up a TTY
In a similar vein, nohup lets you send tasks to the background and seems to be everywhere.
I recently switched to tmux and boy, it's way better. I basically use only tmux now anymore. Creating panes to have two processes in one glance, multiple windows, awesome. Plus all the benefits of screen.
Maybe someone reading wants to now about prefix+s. This doubles your excitement.
Try zellij. Not as popular as tmux, but very intuitive to use.
I Always forget to run screen first, so I just rely heavily on dtach
Simply change your terminal command to execute the terminal multiplexer of your choice.
man terminal_of_choice, look for (start) command.
Don’t use screen, but I do use tmux pretty heavily.
How does screen / tmux work when detached from a session, how does it keep the session alive (both when running locally, and while ssh:ing to a server)? Is there a daemon involved?
pushd and popd to change directory and go back when done there.
Even better when cd automatically invokes pushd.
cd - undoes the last cd. Not quite push/popd but still useful. Pro tip, works also: git checkout -
Hell yeah. Every one of these threads makes me more inclined to read man pages
You should.
These are the actually sources to learn.
what's your alias?
sudo udevadm monitor
Figuring out which usb device went on holiday.
Wow, super useful command. Starring this comment
clear. Constantly, and for no reason.
Ctrl-L
Oh. I know. But you don't understand - I'm compelled to type it out. I must.
I used to, but the terminal clear is better, so I don't.
CMD/CTRL-K for me.
Someone who doesn't know the benefits of dedicated, unlimited scrollback buffers.
This command is useful but has a bad effect (when unintentionally).
I like it so much I alised it to c.
After using too much WINE,
I type pwd, whoami
pv (Pipe Viewer) is a command line tool to view verbose information about data streamed/piped through it. The data can be of any source like files, block devices, network streams etc. It shows the amount of data passed through, time running, progress bar, percentage and the estimated completion time.
sudo
Make me a sandwich.
LambdaRX is not in the sudoers file. This incident will be reported
I just aliased "sudo pacman -Syu && yay -Syu --aur" to "update" cause I got tired of writing it every day.
You can just run yay with no arguments and it does exactly what your update script does.
Huh, the more you know.
Not a specific command, but I learned recently you can just dump any executable script into ~/bin and run it from the terminal.
I suffer greatly from analysis paralysis, I have a very hard time making decisions especially if there's many options. So I wrote a script that reads a text file full of tasks and just picks one. It took me like ten minutes to write and now I spend far more time doing stuff instead of doing nothing and feeling badly that I can't decide what to do.
This is because $HOME/bin is in your $PATH environment variable. You can add more paths that you'd like to execute scripts from, like a personal git repo that contains your scripts.
I think the standard is ~/.local/bin, for the people that like standards.
ls
On my desktop:
df -h to check disk usage
htop to see resource usage
ll list directory contents
I recently found btop and am trying to use that instead of htop.
looks up btop ooooo
ll
df -h
du -sch
Ctrl+r
ll
Is an alias for
ls -al
yea?
I recently learned to use a for loop on the command line to organize hundreds of files in a few seconds.
Example of said Black Magik?
Let's say, for example, you have a directory of files named x01-001; x01-002; x02-001; x02-002; x03-001... and so on.
I want to create subdirectories for each 'x' iteration and move each set to the corresponding subdirectory. My loop would look like this:
for i in {1..3}; do mkdir Data_x0$i && mv x0$i* Data_x0$i; done
I've also been using it if I need to rename large batches of files quickly.
Check out rename
$ touch foo{1..5}.txt
$ rename -v 's/foo/bar/' foo*
foo1.txt renamed as bar1.txt
foo2.txt renamed as bar2.txt
foo3.txt renamed as bar3.txt
foo4.txt renamed as bar4.txt
foo5.txt renamed as bar5.txt
$ rename -v 's/\.txt/.text/' *.txt
bar1.txt renamed as bar1.text
bar2.txt renamed as bar2.text
bar3.txt renamed as bar3.text
bar4.txt renamed as bar4.text
bar5.txt renamed as bar5.text
$ rename -v 's/(.*).text/1234-$1.txt/' *.text
bar1.text renamed as 1234-bar1.txt
bar2.text renamed as 1234-bar2.txt
bar3.text renamed as 1234-bar3.txt
bar4.text renamed as 1234-bar4.txt
bar5.text renamed as 1234-bar5.txt
SED combinator, you win 🙌
xargs is also fun, and assuming your for loop doesn't update anything out of the loop, is highly parallelizable
The equivalent of the same command, that handles 10 tasks concurrently, using %% as a variable placeholder.
But for mass renaming files, dired along with rectangle-select and multicursors within Emacs is my goto.
CTR + u will delete the whole command. I use that a lot so I don't have to backspace. It's saved me a ton of time
Related: Alt + ., to cycle through arguments used in previous commands
control+R
in bash, it lets you quickly search for previously executed commands.
its very useful and makes things much quicker, i recommend you give it a try.
man
fd
entr
rg
gitui
nvim
tee
cd
mv
rm
ls
tmux
btop
yazi
du
xargs
cat
less
Not a command as much as I press the up arrow a lot. I'm.pretty lazy and hitting the up arrow 12 times is easier then retyping a complex rsync command.
you ever use ctrl+r ?
...I do now!
Install the fzf integration for ctrl+r fuzzy finding through your entire shell history:
The rm -rf / variant of the command, if run by a superuser, would cause every file accessible from the present file system to be deleted from the machine.
doesnt actually do anything on gnu rm, and hasnt in like a decade. but yeah, dont do it.
The most deceptive joke I've seen on this is
sudo rm -fr / to remove the French language pack
jq
history | fzf
Fzf is so useful its ridiculous. I recreated the functionality of sshs with fzf and a small bash script.
Check out the for docs. It ships with helpers that offer better shell integration than you're getting here.
Awesome, didn't know fzf yet
nmtui. But that's because my router is trash.
touch 😏
I remember touch
ls -al
I learned you can edit .bashrc (in your home dir) and update the alias for ls to include what I like. It has saved me lots of keystrokes. Mine is ls -lha in addition to whatever color coding stuff is there by default.
You might like eza even more!
Hmm, that's not working for me. You mean use those as options? 'ls -eza'?
Aha. Well, I guess I'm not the target audience because I can't be bothered to go through the installation steps. It's not in the LMDE repository, but I wish it were!
No, eza is one of those modern Rust replacement programs. It replaces ls.
There's a whole bunch of cool modern replacements. Here's a handy list: altbox.dev
I personally use bat and rg all the time, and find them much more suitable for everyday tasks.
The mobile site doesn't have the list. I was so confused.
Ew, sorry. This list is similar and more accessible:
A lot of distros include a .bashrc with common ls aliases commented out, just waiting for you to activate them if you like.
Another ls alias I'm a fan of is ls -latr which I alias to lt. It gives you a time sorted directory listing with the most recent next to your cursor (helpful for large directories).
atools, which includes als, aunpack, apack. so you can stop caring about the kind of archive and just unpack it. it also saves you from shit archives that have multiple files/dirs in their root.
perl -e / perl -lne / ...
units
bc - a calculator that's actually good
pass - the only non-shit password store tool i've found so far. no gui, uses gpg and git to do the encrypting and storage/sharing
alias lr='ls -lrth' - so you can easily find the newest file, cos that's frequently what you want
unip - my script to look up things in the unicode db
find -type f -exec xzgrep 're' {} + - because xzgrep cant do -r
oh yeah, and for the shell readline, alt-b, alt-f, ctrl-w, ctrl-u, ctrl-k, ctrl-a, ctrl-e
compgen -back to see everything all valid things you can type into a shell.
Alt + F4
Neofetch
Get on with the times, install fastfetch ;)
locate, from the mlocate package. So useful. Honorable mention goes out to tldr.
less, watch
Getting cheatsheets via curl cheat.sh/INSERT_COMMAND_HERE
No install necessary, Also, you can quickly search within the cheatsheets via ~. For example if you copy curl cheat.sh/ls~find will show all the examples of ls that use find. If you remove ~find, then it shows all examples of ls.
I have a function in my bash alias for it (also piped into more for readability):
function cht() { curl cheat.sh/"$1"?style=igor|more }
I really like that
cd
command. :PYou'll love
zoxide
then.It's six letters. Can't they just call it
zd
or something? Yeah sure, I can use aliases, but why complicate in the first place?The command is 'z'
This is most probably a distro-specific aliasing. Tried it on Guix, it does not work:
It's in the official docs for zoxide, you are supposed to use the z alias, and many distros just set it up directly like that. I love doing
z notes
from wherever I am.Description fifth point (5.)
That doesn't require a separate package, especially one which uses eval on every new shell. And isn't messing with my distros or personal aliases (and doesn't introduce cargo-packaging).
Simply adding one to two (you get the gist) directories and a keybind for
cd ..
is more slick. There are cases where you might usepushd .
but even then other tooling should already cover your needs.It's also so easy that you can temporarly append to
$CDPATH
for a specific session. But again, then a second pane or pushd is already available.Now downvote me, lemmy.
On arch the command is just
z
Hm I wonder, is it really a command? I thought it is just a function of the shell to change the working directory.
A command is anything you execute in the shell.
cd
is just a built-in commandsudo !!
to rerun last command as sudo.history
can be paired with!5
to run the fifth command listed in history.Fifth as in fifth most recent command or fifth oldest?
I believe it's the fifth oldest - I think
!-5
will get you the fifth impost recent, but I was shown that and haven't put it into practice.The most common usecase I do is something like
history | grep docker
to find docker commands I've ran, then use!
followed by the number associated with the command I want to run in history.Since nobody has said yet, I use screen pretty heavily. Want to run a long running task, starting it from your phone? Run screen to create a detachable session then the long running command. You can then safely close out of your terminal or detach with ctrl a, d and continue in your terminal doing something else. screen -r to get back to it.
I would know this as tmux, is there a difference?
no, tmux is a newer screen. some of us havent switched cos we're too lazy i guess? i think the common wisdom is that it's better. i havent tried cos i already know enough of screen and it's fine for me
Or you can learn both and spend the rest of your life trying screen commands in tmux and vice versa.
mmmmmm <3
gnu screen is just a different program than tmux. they do the same thing though
Also, screen can connect to an UART device or serial or anything that offers up a TTY
In a similar vein,
nohup
lets you send tasks to the background and seems to be everywhere.I recently switched to tmux and boy, it's way better. I basically use only tmux now anymore. Creating panes to have two processes in one glance, multiple windows, awesome. Plus all the benefits of screen.
Maybe someone reading wants to now about
prefix+s
. This doubles your excitement.Try zellij. Not as popular as tmux, but very intuitive to use.
I Always forget to run screen first, so I just rely heavily on dtach
Simply change your terminal command to execute the terminal multiplexer of your choice.
man terminal_of_choice
, look for (start) command.Don’t use
screen
, but I do usetmux
pretty heavily.How does screen / tmux work when detached from a session, how does it keep the session alive (both when running locally, and while ssh:ing to a server)? Is there a daemon involved?
pushd and popd to change directory and go back when done there.
Even better when
cd
automatically invokespushd
.cd -
undoes the last cd. Not quite push/popd but still useful. Pro tip, works also: git checkout -Hell yeah. Every one of these threads makes me more inclined to read man pages
You should. These are the actually sources to learn.
what's your alias?
sudo udevadm monitor
Figuring out which usb device went on holiday.
Wow, super useful command. Starring this comment
clear
. Constantly, and for no reason.Ctrl-L
Oh. I know. But you don't understand - I'm compelled to type it out. I must.
I used to, but the terminal clear is better, so I don't.
CMD/CTRL-K for me.
Someone who doesn't know the benefits of dedicated, unlimited scrollback buffers. This command is useful but has a bad effect (when unintentionally).
I like it so much I alised it to
c
.After using too much WINE, I type
pwd
,whoami
pv (Pipe Viewer) is a command line tool to view verbose information about data streamed/piped through it. The data can be of any source like files, block devices, network streams etc. It shows the amount of data passed through, time running, progress bar, percentage and the estimated completion time.
sudo
Make me a sandwich.
LambdaRX is not in the sudoers file. This incident will be reported
Eh, guess I won't get anything for christmas.
sudo pacman -Syu
I just aliased "sudo pacman -Syu && yay -Syu --aur" to "update" cause I got tired of writing it every day.
You can just run
yay
with no arguments and it does exactly what your update script does.Huh, the more you know.
Not a specific command, but I learned recently you can just dump any executable script into ~/bin and run it from the terminal.
I suffer greatly from analysis paralysis, I have a very hard time making decisions especially if there's many options. So I wrote a script that reads a text file full of tasks and just picks one. It took me like ten minutes to write and now I spend far more time doing stuff instead of doing nothing and feeling badly that I can't decide what to do.
This is because
$HOME/bin
is in your$PATH
environment variable. You can add more paths that you'd like to execute scripts from, like a personal git repo that contains your scripts.I think the standard is ~/.local/bin, for the people that like standards.
ls
On my desktop:
df -h
to check disk usagehtop
to see resource usagell
list directory contentsI recently found btop and am trying to use that instead of htop.
looks up btop ooooo
ll
df -h
du -sch
Ctrl+r
Is an alias for
yea?
I recently learned to use a for loop on the command line to organize hundreds of files in a few seconds.
Example of said Black Magik?
Let's say, for example, you have a directory of files named x01-001; x01-002; x02-001; x02-002; x03-001... and so on.
I want to create subdirectories for each 'x' iteration and move each set to the corresponding subdirectory. My loop would look like this:
for i in {1..3}; do mkdir Data_x0$i && mv x0$i* Data_x0$i; done
I've also been using it if I need to rename large batches of files quickly.
Check out
rename
SED combinator, you win 🙌
xargs
is also fun, and assuming your for loop doesn't update anything out of the loop, is highly parallelizableThe equivalent of the same command, that handles 10 tasks concurrently, using
%%
as a variable placeholder.But for mass renaming files,
dired
along with rectangle-select and multicursors within Emacs is my goto.CTR + u will delete the whole command. I use that a lot so I don't have to backspace. It's saved me a ton of time
Related: Alt +
.
, to cycle through arguments used in previous commandscontrol+R
in bash, it lets you quickly search for previously executed commands.
its very useful and makes things much quicker, i recommend you give it a try.
Not a command as much as I press the up arrow a lot. I'm.pretty lazy and hitting the up arrow 12 times is easier then retyping a complex rsync command.
you ever use ctrl+r ?
...I do now!
Install the fzf integration for ctrl+r fuzzy finding through your entire shell history:
https://thevaluable.dev/fzf-shell-integration/
If you know it was the most recent rsync command: just type !rsync.
sudo rm -rf /
Very powerful yet helpful command :-)
Someone has to say this. Don't do it anyone
Agree. Don’t just copy and paste CLI commands you find on the internet, suggested by a stranger
Instructions unclear, dick now stuck in computer.
Lp0 on fire
For reference: https://en.m.wikipedia.org/wiki/Rm_(Unix)
doesnt actually do anything on gnu rm, and hasnt in like a decade. but yeah, dont do it.
The most deceptive joke I've seen on this is
sudo rm -fr /
to remove the French language packjq
Fzf is so useful its ridiculous. I recreated the functionality of sshs with fzf and a small bash script.
Check out the for docs. It ships with helpers that offer better shell integration than you're getting here.
Awesome, didn't know fzf yet
nmtui. But that's because my router is trash.
touch
😏I remember
touch
ls -al
I learned you can edit
.bashrc
(in your home dir) and update the alias for ls to include what I like. It has saved me lots of keystrokes. Mine isls -lha
in addition to whatever color coding stuff is there by default.You might like
eza
even more!Hmm, that's not working for me. You mean use those as options? 'ls -eza'?
No, it's like an ls replacement: https://github.com/eza-community/eza
Aha. Well, I guess I'm not the target audience because I can't be bothered to go through the installation steps. It's not in the LMDE repository, but I wish it were!
No,
eza
is one of those modern Rust replacement programs. It replacesls
.There's a whole bunch of cool modern replacements. Here's a handy list: altbox.dev
I personally use
bat
andrg
all the time, and find them much more suitable for everyday tasks.The mobile site doesn't have the list. I was so confused.
Ew, sorry. This list is similar and more accessible:
https://github.com/ibraheemdev/modern-unix
A lot of distros include a .bashrc with common
ls
aliases commented out, just waiting for you to activate them if you like.Another
ls
alias I'm a fan of isls -latr
which I alias tolt
. It gives you a time sorted directory listing with the most recent next to your cursor (helpful for large directories).atools
, which includesals
,aunpack
,apack
. so you can stop caring about the kind of archive and just unpack it. it also saves you from shit archives that have multiple files/dirs in their root.perl -e
/perl -lne
/ ...units
bc
- a calculator that's actually goodpass
- the only non-shit password store tool i've found so far. no gui, uses gpg and git to do the encrypting and storage/sharingalias lr='ls -lrth'
- so you can easily find the newest file, cos that's frequently what you wantunip
- my script to look up things in the unicode dbfind -type f -exec xzgrep 're' {} +
- because xzgrep cant do -roh yeah, and for the shell readline, alt-b, alt-f, ctrl-w, ctrl-u, ctrl-k, ctrl-a, ctrl-e
compgen -back
to see everything all valid things you can type into a shell.Alt + F4
Neofetch
Get on with the times, install fastfetch ;)
locate
, from themlocate
package. So useful. Honorable mention goes out totldr
.less
,watch
Getting cheatsheets via
curl cheat.sh/INSERT_COMMAND_HERE
No install necessary, Also, you can quickly search within the cheatsheets via
~
. For example if you copycurl cheat.sh/ls~find
will show all the examples ofls
that usefind
. If you remove~find
, then it shows all examples ofls
.I have a function in my bash alias for it (also piped into
more
for readability):function cht() { curl cheat.sh/"$1"?style=igor|more }
Sudo !!
It reruns the last command as sudo.
Pretty useful since I'm always forgetting.
Ctrl-r with https://github.com/atuinsh/atuin is amazing. Never forget a command you used ever again.
I trigger it with the up arrow.
not sure if it counts as a command, but i use the up arrow to scroll through previous commands like, almost every time I open a terminal.
Ctrl-R: (type something)
plz
from https://github.com/m1guelpf/plz-clicd
every single day.ranger
If you change the colours to night mode, the song "Sister Christian" starts playing
flatpak update
Not a command but bang expansions. For example
!?
is the args of last command useful for stuff likemkdir foo ; cd !?
https://www.redhat.com/sysadmin/bash-bang-commands learn these. you suck at using your computer if you don't know them.
Is there something similar in fish shell?
Seems like an appropriate place to share https://github.com/agarrharr/awesome-cli-apps
I'm a fan of ripgrep and lsd in particular.
shred -vzf