9 ms·
Sl: a mirror version of ls
- gjvc 9y agonot quite there but alias sl='/bin/ls -l | tac | rev | column -t'
- dmix 9y agoI was thinking this could be a simple alias with an AWK script.
- stochastic_monk 9y agoThe `wc -L` call fails on my Mac, but if I substitute gwc (as I have GNU coreutils available with a "g" prefix), it works.
- pubby 9y agoI always liked the story about the guy who aliased emacs to be 'em'. Until one day he accidentally typed an 'r' instead of an 'e'. It turns out aliases can cost a lot more time than they can save!
- staz 9y agoNot to be confounded with the other project of the same name (and with the same purpose) https://github.com/mtoyoda/sl https://github.com/mtoyoda/sl
- oneeyedpigeon 9y agoIt's mentioned right in the very first paragraph of the article.
- pantalaimon 9y agoOr you just alias sl=ls and have productivity reach unseen levels!
- blakesterz 9y agoI have a few "idiot aliases" like that... alias grpe=grep alias gerp=grep
- mulmen 9y agoMy personal favorite is: alias fuck='sudo $(fc -nl -1)' Be very careful with this.
- epse 9y agoWhat about the actual program thefuck? It can fix more than just sudo, and asks you to confirm
- ben509 9y agoOr make history work for you: shopt -s histverify histreedit Bash will let you then confirm the actual command it's going to run: sudo !!
- mulmen 9y agoI use zsh and I don't know what shopt is. That's two commands and !! doesn't work in aliases.
- thecatspaw 9y ago> Consider this code GPLv3 licensed. is this actually valid? Does it mean the code _is_ GPLv3 licensed or not?
- simias 9y agoCreate a closed source product based on the code and find out!
- deleted 9y ago[deleted]
- icebraining 9y agoSeems rather clear. The code itself also has a line indicating that license.
- joombaga 9y agoIt is GPLv3 licensed, according to the second line.
- jstanley 9y agoI think that is sufficient to make it GPLv3 licensed, but it places a bit of a burden on anyone who wants to redistribute it: > 4. Conveying Verbatim Copies. > You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. If you want to redistribute it you have to go to your own efforts to give everyone you distribute it to a copy of the GPLv3 text.
- p3llin0r3 9y agoI like to add "install https://github.com/mtoyoda/sl" https://github.com/mtoyoda/sl" to my companies "Getting started" documentation to prank new hires. Great fun!
- timerol 9y agoIf I have sudo access on a friends machine, installing Steam Locomotive is generally the first thing I do. Adding it to the "Getting started" docs at my company does sound like a good idea.
- smoyer 9y agoRemove the trailing double-quote from the above URL to get to the intended destination.
- burnte 9y agoI was hoping someone posted this, if not I was going to. I installed it on one of my home servers YEARS ago, and forgot about it until a couple years later I typoed "sl" and it chooched across my screen. I howled with laughter at it, and at setting myself up years in advance.
- mverwijs 9y agoNo no no. There is only one 'sl'. https://asciinema.org/a/172723 https://asciinema.org/a/172723
- wewake 9y agoThank you. You made my day! :D I'm confident that there are other such commands that I'm unaware of and don't know how to find them. May be you could help out.
- WalterGR 9y agoInteresting. Faced with the choice of punishing myself for making a mistake vs. adapting my environment to accommodate me, I'll always choose the latter. (Plus, since you use `ls` so frequently, just make `l` an alias of it, especially if you have difficulty typing "ls"! Using a computer doesn't have to be some weird, punishing, bondage and discipline experience.)
- arbie 9y agoAgree. It's why I alias . to pwd and .. to go up a directory.
- jhauris 9y agothose are great, definitely adding those aliases.
- moehm 9y agoAnd "alias ...='cd ../../'" etc. Gotta love this feature.
- kbd 9y agoHere are some of what I use: alias -- -='cd -' alias ..='cd ..' alias ...='cd ../..' alias ....='cd ../../..' alias .....='cd ../../../..' alias ......='cd ../../../../..' alias l=ls alias la='ls -a' alias ll='ls -l' alias lla='ls -la'
- msoucy 9y agoI personally have a single function that takes care of all of those dotted aliases: function up { local ups="." for((i=0;i<${1:-1};i++)); do ups="${ups}/.." done cd "$ups" }
- kbd 9y agoI appreciate the DRY-ness of it, but that requires you to type 'up ...' which is longer :( A while ago when I was bored I was thinking of golfing those aliases to say (pseudocode): for i in 2..6: alias '.'*i=cd '../'*i but I didn't know all the shell needed and just wound up leaving it as is. Edit: turns out Zsh has a 'repeat' built-in: alias $(repeat 7 echo -n '.')="cd $(repeat 7 echo -n '../')" Still, non-portable, less clear, not worth changing the aliases.
- gue5t 9y agoThis code is incorrect: it has a a race condition that can cause it to use the wrong maximum width in its listing.
- afranchuk 9y agoI don't want to sound high and mighty or anything, but I've never mistyped 'ls'. I occasionally mistype other short binaries/commands, but typically anything more than ~4 characters has me hitting tab, and that usually completes uniquely and (obviously) correctly.
- wybiral 9y agoI've never typed "sl" either. I have accidentally typed "l" and hit enter only to be surprised that it's aliased to "ls -CF".
- fragmede 9y agoThen you're typing slower than you could. By all means, type however you want to type, but if you never ever make a mistake, then you could push yourself harder.
- dkbrk 9y agoI don't think this is really accurate. In my experience, the primary factor limiting my typing speed is the rate of errors. It's generally around 1-2%, but the time noticing and fixing those errors takes a disproportionate amount of time. In other words, to type fast, learn to type accurately and gradually speed up while maintaining your accuracy.
- afranchuk 9y agoDunno about that. I type pretty fast (don't have exact numbers to back that up, just other people's comments) But regardless of that, typing two characters that are on opposite sides of the keyboard and each use a separate hand is, for me, pretty much error free. I make mistakes when letters are closer and using the same hand.
- oblio 9y agoThis should go the whole hog: https://ubuntuforums.org/archive/index.php/t-2078323.html https://ubuntuforums.org/archive/index.php/t-2078323.html
- pronoiac 9y agoSee also, gti: http://r-wos.org/hacks/gti http://r-wos.org/hacks/gti
- tobyhinloopen 9y agoAs a golf owner, lol
- dexen 9y agoIn similar vein: express your inner rage while terminating offending processes. https://github.com/robotlolita/fuck-you https://github.com/robotlolita/fuck-you
- saagarjha 9y agoKilling one memory hogging processor with another!
- combatentropy 9y agoa beautiful web page, and its only CSS is this: body { max-width: 50em; margin: auto; padding: 1em; line-height: 1.5em; } pre { overflow-x: auto; }
- girst 9y agoThanks!
- oneeyedpigeon 9y agoYeah, but that's some horrible use of the fieldset element ;)
- tomxor 9y agoMaybe i'm just weird but I can't recall ever making this typo, I find myself making letter-swap typos of words/commands with letters on the same hand often enough but that's not quite so easy with ls.
- jake-low 9y agoMaybe it’s your keyboard layout? I used to make this typo (ls -> sl) on QWERTY, but I later switched to Dvorak where both L and S are typed with the right pinky. I think it slowed me down enough on that keypair that it never happens anymore.
- godot 9y agoI was going to post this same comment. I letter-swap typos on many commands, but I've never in 20+ years made the typo of "sl" when I type "ls".
- _Marak_ 9y agoProbably an unpopular opinion, but I find aliases and extensive dotfiles counterproductive. It's better to learn and remember the exact commands. If you find yourself typing the same long command over and over again, the task should probably be automated or scripted as part of a separate pipeline. Assuming you are successful with aliasing and don't accidentally do something unexpected and catastrophic to your system, the moment you login to another system you will be lost and unable to remember any of the original and core commands.
- stochastic_monk 9y agoThere are plenty of cases where it can be unproductive, but I find it very helpful in some cases. I find `alias gcr="git clone --recursive"` to be very productive for me. I never forget what it stands for, it saves me time, and I never have to go fetch all submodules if the repo uses them. `alias lt=ls -tor` is helpful, as it shows me extra information about files in reverse sorted order, so that the most recently modified files are at the bottom. I don't run any risk of forgetting either of these because of their mnemonic nature, and they're not something I can script.
- aynsof 9y agoI was of the same opinion as the GP until I started using Terraform. Coming from a sysadmin background, I was always told to use default tools 'because one day you'll ssh into a random server and it won't have any of your fancy tools and config'. So I started using Terraform. A lot. Day in, day out, I would type terrafrom, teraform, terrafomr. And I'm a good typist! But something about that word just makes it hard to get out right. (I have a similar issue with 'infrastructure'.) Finally replacing it with a 'tf' alias saved me a lot of frustration.
- outworlder 9y agoThis is actually supporting GP's argument. Why do you have to "type" terraform? Are you running terraform from your own machine? Don't. Setup a Jenkins pipeline or what have you. Unless you happen to work alone – and I'd argue even then. Moving Terraform to Jenkins was the second best thing we have ever done – first thing was moving tfstate to remote storage. You can provide any required parameters (or jenkins can fetch for you), run terraform init, plan, ask for confirmation, apply (and even perform retries). And then run any post steps. Even managers can use terraform now (and we have a pretty complicated setup). I guess only Terraform Enterprise might beat this, but I have little experience with that.
- amichal 9y agoLong ago there was a ms dos. program called “rude dos” that if installed would replace the all commands with versions that randomly and rarely would refuse to work with various rude messages. I always ran it before letting my little brother use my computer :).
- richardkiss 9y agoThis didn't work on Mac OS due to "wc -L" so I whipped up a python version.
- richardkiss 9y agoThis didn't work on Mac OS due to "wc -L" so I whipped up a python version. https://gist.github.com/richardkiss/4fba0c6bd27eb39a9eb56074dd0f2ba4 https://gist.github.com/richardkiss/4fba0c6bd27eb39a9eb56074...
- girst 9y agoHi, author here. Feel free to ask questions!
- iamdave 9y agoI once installed sl on a server. Completely forgot I put it there. It laid there dormant for MONTHS without anyone tripping over it. Then....it happened. "What the...why is my screen blac--is that a train-AW DAMMIT". That person was me. The guy who installed the damn thing. The progression from confusion, to curiosity, to realization that I had in fact...just played myself was kind of amusing in the moment.
- femto113 9y agoFor some reason I don't get ls wrong (right handed so maybe I reliably hit the l first) but I've had the following in my .alias for years # some common typos alias grpe grep alias gpre grep alias mroe more alias mreo more alias rmeo more
- sullyj3 9y agoI always alias "ls" to "l"