- pemptago ( @pemptago@lemmy.ml ) English4•1 hour ago
I went a little overboard and wrote a one-liner to accurately answer this question
history|cut -d " " -f 5|sort|uniq -c|sort -nr|head -5
Note:
history
displays like this for me20622 2023-02-18 16:41:23 ls
I don’t know if that’s because I setHISTTIMEFORMAT='%F %T '
in .bashrc, or if it’s like that for everyone. If it’s different for you change-f 5
to target the command. Use-f 5-7
to include flags and arguments.My top 5 (since last install)
2002 ls 1296 cd 455 hx 427 g 316 find
g
is an alias for gitui. When I include flags and arguments most of the top commands are aliases, often shortcuts to a project directory.Not to ramble, but after doing this I figured I should alias the longest, most-used commands (even aliasing
ls
tol
could have saved 2002 keystrokes :P) So I wrote another one-liner to check for available single characters to alias with:for c in a b c d e f g h i j k l m n o p q r s t u v w x y z; do [[ ! $(command -v $c) ]] && echo $c; done
In .bash_aliases I’ve added
alias b='hx ${HOME}/.bash_aliases'
to quickly edit aliases andalias r='source ${HOME}/.bashrc'
to reload them. - Spider89 ( @Spider89@lemm.ee ) 2•1 hour ago
nano
- kittenzrulz123 ( @kittenzrulz123@lemmy.blahaj.zone ) 1•18 minutes ago
Btop is an amazing resource monitor
- daq ( @daq@lemmy.sdf.org ) 1•2 minutes ago
Have you tried glances?
- Revan343 ( @Revan343@lemmy.ca ) 1•7 minutes ago
Uhhh…
sudo su
Don’t be like me
- squid_slime ( @squid_slime@lemm.ee ) 1•2 hours ago
du -sh /too/bar
to get size of files/folders.sudo !!
inserts sudo into previous command when forgotten.yay
for full system update if yay is installed.cat
reads files. - plumcreek ( @plumcreek@lemmy.ml ) English3•2 hours ago
qmv -f do ${dir}
… for quickly moving and renaming files. The default ‘qmv’ opens up your preferred text editor with a list of the source and destination name of the directory of files you want to move/rename. The ‘-f do’ tells the command we only want to see/edit the [d]estination [o]nly. If you need to rename/move a bunch of files, it’s much quicker to do it in vim (at least for me).
- drcouzelis ( @drcouzelis@lemmy.zip ) English1•2 hours ago
It sounds similar to one of my favorite commands! vidir 🙂
- some_guy ( @some_guy@lemmy.sdf.org ) 3•3 hours ago
cd
every single day. - Korthrun ( @korthrun@lemmy.sdf.org ) 3•3 hours ago
Seems like an appropriate place to share https://github.com/agarrharr/awesome-cli-apps
I’m a fan of ripgrep and lsd in particular.
- x00za ( @x00za@lemmy.dbzer0.com ) English1•8 minutes ago
Big fan of lsd too.
But on a blotter
- NaevaTheRat ( @NaevaTheRat@vegantheoryclub.org ) English2•5 hours ago
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.
- Andromxda 🇺🇦🇵🇸🇹🇼 ( @Andromxda@lemmy.dbzer0.com ) English1•3 hours ago
Is there something similar in fish shell?
- umbrella ( @umbrella@lemmy.ml ) 10•6 hours ago
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.
- Shimon ( @Shimon@slrpnk.net ) 1•5 hours ago
sl
- papertowels ( @papertowels@lemmy.one ) 24•10 hours ago
sudo !!
to rerun last command as sudo.history
can be paired with!5
to run the fifth command listed in history.- communism ( @communism@lemmy.ml ) 2•10 hours ago
Fifth as in fifth most recent command or fifth oldest?
- papertowels ( @papertowels@lemmy.one ) 3•8 hours ago
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.
- sgtnasty ( @sgtnasty@lemmy.ml ) 9•9 hours ago
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.
- BougieBirdie ( @Bougie_Birdie@lemmy.blahaj.zone ) English13•11 hours ago
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.
- unknowing8343 ( @unknowing8343@discuss.tchncs.de ) 9•8 hours ago
I think the standard is ~/.local/bin, for the people that like standards.
- notfromhere ( @notfromhere@lemmy.ml ) 18•13 hours ago
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.
- verdare [he/him] ( @verdare@beehaw.org ) 3•5 hours ago
Don’t use
screen
, but I do usetmux
pretty heavily. - gitamar ( @gitamar@feddit.org ) Deutsch5•6 hours ago
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.
- krash ( @krash@lemmy.ml ) 1•5 hours ago
Try zellij. Not as popular as tmux, but very intuitive to use.
- 7dev7random7 ( @7dev7random7@suppo.fi ) 1•5 hours ago
Maybe someone reading wants to now about
prefix+s
. This doubles your excitement.
- krash ( @krash@lemmy.ml ) 1•5 hours ago
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?
- darvit ( @darvit@lemmy.darvit.nl ) 1•1 hour ago
You can find out by running screen and executing pstree, that way you can see how the screen process is run.
- papertowels ( @papertowels@lemmy.one ) 4•8 hours ago
In a similar vein,
nohup
lets you send tasks to the background and seems to be everywhere. - muzzle ( @muzzle@lemm.ee ) 2•9 hours ago
I Always forget to run screen first, so I just rely heavily on dtach
- 7dev7random7 ( @7dev7random7@suppo.fi ) 1•6 hours ago
Simply change your terminal command to execute the terminal multiplexer of your choice.
man terminal_of_choice
, look for (start) command.
- tetris11 ( @tetris11@lemmy.ml ) 2•12 hours ago
Also, screen can connect to an UART device or serial or anything that offers up a TTY