papertowels ( @papertowels@lemmy.one ) 39•6 months agosudo !!
to rerun last command as sudo.history
can be paired with!5
to run the fifth command listed in history. communism ( @communism@lemmy.ml ) 3•6 months agoFifth as in fifth most recent command or fifth oldest?
papertowels ( @papertowels@lemmy.one ) 4•6 months agoI 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.
notfromhere ( @notfromhere@lemmy.ml ) 23•6 months agoSince 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.
gitamar ( @gitamar@feddit.org ) Deutsch6•6 months agoI 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•6 months agoTry zellij. Not as popular as tmux, but very intuitive to use.
7dev7random7 ( @7dev7random7@suppo.fi ) 1•6 months agoMaybe someone reading wants to now about
prefix+s
. This doubles your excitement.
papertowels ( @papertowels@lemmy.one ) 6•6 months agoIn a similar vein,
nohup
lets you send tasks to the background and seems to be everywhere. tetris11 ( @tetris11@lemmy.ml ) 3•6 months agoAlso, screen can connect to an UART device or serial or anything that offers up a TTY
verdare [he/him] ( @verdare@beehaw.org ) 3•6 months agoDon’t use
screen
, but I do usetmux
pretty heavily. muzzle ( @muzzle@lemm.ee ) 2•6 months agoI Always forget to run screen first, so I just rely heavily on dtach
7dev7random7 ( @7dev7random7@suppo.fi ) 1•6 months agoSimply change your terminal command to execute the terminal multiplexer of your choice.
man terminal_of_choice
, look for (start) command. muzzle ( @muzzle@lemm.ee ) 1•6 months agoNo thanks, I’m good
krash ( @krash@lemmy.ml ) 1•6 months agoHow 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•6 months agoYou can find out by running screen and executing pstree, that way you can see how the screen process is run.
pemptago ( @pemptago@lemmy.ml ) English23•6 months agoI 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. JackbyDev ( @JackbyDev@programming.dev ) English1•6 months agohistory -i
BougieBirdie ( @Bougie_Birdie@lemmy.blahaj.zone ) English22•6 months agoNot 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 ) 16•6 months agoI think the standard is ~/.local/bin, for the people that like standards.
potentiallynotfelix ( @potentiallynotfelix@lemmy.fish ) English2•6 months agoor add it to path
umbrella ( @umbrella@lemmy.ml ) 21•6 months agocontrol+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.
secret300 ( @secret300@lemmy.sdf.org ) 1•6 months agoI use this constantly
sgtnasty ( @sgtnasty@lemmy.ml ) 15•6 months agopv (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.
HeartyOfGlass ( @HeartyOfGlass@lemm.ee ) English14•6 months agoclear
. Constantly, and for no reason. igorette ( @igorette@lemmy.ml ) 21•6 months agoCtrl-L
HeartyOfGlass ( @HeartyOfGlass@lemm.ee ) English15•6 months agoOh. I know. But you don’t understand - I’m compelled to type it out. I must.
omxxi ( @omxxi@feddit.org ) English1•6 months agohaha, I can relate to that :). formerly I had the compulsion to execute sync frequently. Now my compulsion is to push Ctrl-C like 4 times every time I need it. I read somewhere that’s common because of ^C has a lack of feedback to the user, so, a script showing an alert that the clipboard received some information helped with this compulsion.
Pup Biru ( @pupbiru@aussie.zone ) English1•6 months agoi’d like to introduce you to your new best friend: reset… it doesn’t everything clear does and a LOT more
Revan343 ( @Revan343@lemmy.ca ) 14•6 months agoUhhh…
sudo su
Don’t be like me
vrighter ( @vrighter@discuss.tchncs.de ) 6•6 months agosudo -i
sp451 ( @sp451@lemmy.sdf.org ) 13•6 months agosudo rm -rf /
Very powerful yet helpful command :-)
makingStuffForFun ( @makingStuffForFun@lemmy.ml ) 17•6 months agoSomeone has to say this. Don’t do it anyone
sp451 ( @sp451@lemmy.sdf.org ) 14•6 months agoAgree. Don’t just copy and paste CLI commands you find on the internet, suggested by a stranger
Hux ( @Hux@lemmy.ml ) 4•6 months agoFor reference: https://en.m.wikipedia.org/wiki/Rm_(Unix)
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.
papertowels ( @papertowels@lemmy.one ) 9•6 months agoThe most deceptive joke I’ve seen on this is
sudo rm -fr /
to remove the French language pack potentiallynotfelix ( @potentiallynotfelix@lemmy.fish ) English7•6 months agoI did this on my personal computer just to prove a point.
lud ( @lud@lemm.ee ) 11•6 months agoAs primarily a Windows admin (Yes, we exist on Lemmy ;) ) here are few I use often.
Enter-PSSesion
Get-ADUser
(also group and computer)CLS
(aka the superiorclear
)ii .
(short forInvoke-Item .
which runs the selected object using the default method. For paths (like.
) the default is explorer, soii .
opens the current directory using explorer.)ft
(short forFormat-Table
formats piped input as a table.)fl
(short forformat-like
. Used likeft
but for lists.)Where-Object
Select-Object
mexicancartel ( @mexicancartel@lemmy.dbzer0.com ) English18•6 months ago lud ( @lud@lemm.ee ) 2•6 months agoFucking hell Lol 😂
Appoxo ( @Appoxo@lemmy.dbzer0.com ) 10•6 months agols and cd
AdNecrias ( @AdNecrias@lemmy.pt ) 2•6 months agoI sometimes hit ls and then need to type dir.
Appoxo ( @Appoxo@lemmy.dbzer0.com ) 4•6 months agoThe amount of times i tried to dir in linux and ls in windows is mire than I like to admit
Shimon ( @Shimon@slrpnk.net ) 9•6 months agosl
Nailbar ( @nailbar@sopuli.xyz ) 4•6 months agoChoo choo!
some_guy ( @some_guy@lemmy.sdf.org ) 9•6 months agocd
every single day. lluki ( @lluki@feddit.org ) 9•6 months agoxdg-open FILE
- opens a file with the default GUI app. I use it for example to open PDFs and PNG. I have a one letter alias for that. It can also open a file explorer in the current directoryxdg-open .
. Should work on any compliant desktop environment (gnome/kde). Korthrun ( @korthrun@lemmy.sdf.org ) 8•6 months agoSeems like an appropriate place to share https://github.com/agarrharr/awesome-cli-apps
I’m a fan of ripgrep and lsd in particular.