Unix Commands I Wish I’d Discovered Years Earlier
131–140 of 259 posts
Re: Unix Commands I Wish I’d Discovered Years Earlier
#132 history | grep
I use this for rsync or rdesktop when I have forgotten the long list of options & directories etcI also use ctrl R at the bash prompt but that only gives me the most recent match.
Re: Unix Commands I Wish I’d Discovered Years Earlier
#133Re: Unix Commands I Wish I’d Discovered Years Earlier
#134Re: Unix Commands I Wish I’d Discovered Years Earlier
#135Rather than 'man 7 ascii', there's the 'ascii' command itself. It will also provide encodings for single characters: $ ascii a ASCII 6/1 is decimal 097, hex 61, octal 141, bits 01100001: prints as `a' Official name: Miniscule a Other names: Small a, Lowercase a ASCII 0/10 is decimal 010, hex 0a, octal 012, bits 00001010: called ^J, LF, NL Official name: Line Feed Other names: Newline, \n
Which Unix includes that command?
Re: Unix Commands I Wish I’d Discovered Years Earlier
#136One of the more useful bits of ssh is not mentioned: remotely running commands. Example: ssh username@host "echo $HOSTNAME && sudo somecommand && cat somecommand.log" There's probably a better way to do this, but in a pinch I can fix a problem on dozens of machines just by altering the host string.
Yeah, before I was heavily into automation (i.e. puppet) this was my go to command. Use a for loop and ssh to run things on a group of systems. for host in h-abc h-def h-ghi h-jkl h-mno h-pqr h-stu h-vwx h-yza; do ssh -l root $host "hostname; echo "1.1.1.1 server" >> /etc/hosts"; done This would iterate over hosts (h-abc .. h-yza) and run the commands "hostname; echo "1.1.1.1 server" >> /etc/hosts". Or maybe use a fo…
Re: Unix Commands I Wish I’d Discovered Years Earlier
#137history | grep I use this for rsync or rdesktop when I have forgotten the long list of options & directories etc I also use ctrl R at the bash prompt but that only gives me the most recent match.
Re: Unix Commands I Wish I’d Discovered Years Earlier
#138Replaces the current day of the month with []: $ cal | sed "s/.*/ & /;s/ $(date +%e) / [] /" September 2013 Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 7 8 9 [] 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
Hmm, the day is already highlighted for me (inverted color).
Re: Unix Commands I Wish I’d Discovered Years Earlier
#139Re: Unix Commands I Wish I’d Discovered Years Earlier
#140Command line globbing! For the uninitiated: Let's say my pwd is `/home/projects` and i want to edit `/home/projects/a_huge_sprawling_app/940j_394/lol/flight_controller.rb` `vim **/flight_controller.rb` opens our flight_controller.rb straight away. In terms of effort, this allows you to basically omit a `find -name` when you're in a rush to edit some damn file where the hell is it again damn we need to reevaluate this…
[1]: https://www.gnu.org/software/bash/manual/bash.html#The-Shopt...