Earlier quoted context omitted.
If you don't want to clog up your terminal, try 'less' and then hit 'F' to follow.
Better yet use 'less +F'. It's as easy to remember as tail -f. The advantage of using less here is that you can easily interrupt the tailing (ctrl-c). For example, to search. Then just hit 'F' again to restart tailing. But now your search pattern will be highlighted as the data streams by.
Unix Commands I Wish I’d Discovered Years Earlier
91–100 of 259 posts
Re: Unix Commands I Wish I’d Discovered Years Earlier
#92Replaces 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).
cal | catRe: Unix Commands I Wish I’d Discovered Years Earlier
#93Earlier quoted context omitted.
The single most useful thing about ssh to me is that it connects stdout/in across the channel (this is behavior inherited from rsh). This allows for e.g.: % (cd /foo; tar cpf - .) | ssh bar \(cd /baz\; tar xpf -\) Or: % cat ~/.ssh/id_rsa.pub | ssh bar tee -a .ssh/authorized_keys
Forgive my ignorance, but I don't know what what it means to connect "across the channel", but it sounds important. Do you know a link that explains the concept? I've failed to Google it.
Re: Unix Commands I Wish I’d Discovered Years Earlier
#94Earlier quoted context omitted.
One of my favorite things about unix is that you can chain commands together with pipe (|). Say for example that you have a example data file that looks like this: # Deflection Col-Force Beam-Force 0.000 0 0 0.001 104 51 0.002 202 101 0.003 298 148 0.0031 104 149 0.004 289 201 0.0041 291 209 0.005 104 250 0.010 311 260 0.020 104 240 You can chain commands together to quickly get ball park figures. I do this all the t…
Yes, there are some ways to simplify. You can get rid of the "UUOC". Instead of cat data.txt | grep -v '#' you can do: grep -v '#' data.txt or you can simplify further by moving the grepping into awk, so that the full command becomes awk '!/#/{print $2}' data.txt | sort -n | uniq -c sort -n is good to use for sorting numbers. You could probably pull the sort | uniq -c into awk somehow, but I have already demonstrated…
sort -n -f 2 Re: Unix Commands I Wish I’d Discovered Years Earlier
#95I recently discovered whatis and I love it.
Want to find all the tools on your system that use the curses library (for user-friendly interfaces)? Try this:
for i in `\ls /bin/* /sbin/* /usr/bin/* /usr/sbin/* | sort -u` ; do ldd $i 2>/dev/null | grep -q curses && whatis `basename $i` ; done | grep -v 'nothing appropriate'
Don't know how your current path finds a program? Use which: pwillis@zippy:~$ which df
/usr/bin/df
pwillis@zippy:~$ which mount
/bin/mount
Annoyed that /sbin and /usr/sbin aren't in your path? Use whereis: pwillis@zippy:~$ which ifconfig
which: no ifconfig in (/usr/local/bin:/usr/bin:/bin:/usr/games:/usr/lib64/kde4/libexec:/usr/kerberos/bin:/usr/lib64/java/bin:/usr/lib64/java/jre/bin:/usr/lib64/qt/bin:/usr/share/texmf/bin:.)
pwillis@zippy:~$ whereis ifconfig
ifconfig: /sbin/ifconfig /usr/man/man8/ifconfig.8.gz /usr/share/man/man8/ifconfig.8.gz /usr/X11/man/man8/ifconfig.8.gzRe: Unix Commands I Wish I’d Discovered Years Earlier
#96Mac OS: pbpaste & pbcopy For instance: pbpaste | fgrep -i "`pbpaste -pboard find`" To search the copy clipboard with the find clipboard.
xclip -o -selection clipboardRe: Unix Commands I Wish I’d Discovered Years Earlier
#97One 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.
The single most useful thing about ssh to me is that it connects stdout/in across the channel (this is behavior inherited from rsh). This allows for e.g.: % (cd /foo; tar cpf - .) | ssh bar \(cd /baz\; tar xpf -\) Or: % cat ~/.ssh/id_rsa.pub | ssh bar tee -a .ssh/authorized_keys
% (cd /foo && tar cpf - .) | ssh bar '(cd /baz && tar xpf -)'
or explore something like: % rsync -aSHx --update --delete -e ssh /foo/ user@bar:baz/.Re: Unix Commands I Wish I’d Discovered Years Earlier
#98Re: Unix Commands I Wish I’d Discovered Years Earlier
#99Earlier quoted context omitted.
I didn't add xxd on my local FBSD (installed last night) setup, and my remote FBSD shell has xxd installed by default... $ uname -rms FreeBSD 9.1-RELEASE-p7 amd64 $ xxd -v xxd V1.10 27oct98 by Juergen Weigert Perhaps different builds have different things included?
No, it installs as part of vim : https://news.ycombinator.com/item?id=6361210
You're right, xxd is included with vim, but as an external program.
Vim provides this capability through the external program xxd, which is included by default in standard distributions of Vim.
My pedantic nature was hung up on the release dates of the respective programs, as xxd predates vim on Unix.
Re: Unix Commands I Wish I’d Discovered Years Earlier
#100I really love pushd/popd.
alias d='[ ${#DIRSTACK[@]} -gt 0 ] && for i in `jot ${#DIRSTACK[@]} 1 ${#DIRSTACK[@]} 1`; do echo ${DIRSTACK[$i-1]}; done; echo $PWD'
alias popd='[ ${#DIRSTACK[@]} -gt 0 ] && { cd "${DIRSTACK[${#DIRSTACK[@]}-1]}"; unset DIRSTACK[${#DIRSTACK[@]}-1]; }; d'
alias pushd='DIRSTACK[${#DIRSTACK[@]}]="$PWD"; cd'