Berkeley CSUA MOTD:Entry 51932
Berkeley CSUA MOTD
2018/01/23 [General] UID:1000 Activity:popular

2008/11/12-13 [Computer/SW/Unix] UID:51932 Activity:nil
11/12   May be useful if you want to learn UNIX tricks (good for noobs,
        good refresher for others):
        \_ that was not lol.  and actually a waste of time. lol lol lol lol.
        \_ waste of time.  yawn.
ERROR, url_link recursive (eces.Colorado.EDU/secure/mindterm2) 2018/01/23 [General] UID:1000 Activity:popular

You may also be interested in these entries...
2012/8/29-11/7 [Computer/SW/Security] UID:54467 Activity:nil
8/29    There was once a CSUA web page which runs an SSH client for logging
        on to soda.  Does that page still exist?  Can someone remind me of the
        URL please?  Thx.
        \_ what do you mean? instruction on how to ssh into soda?
           \_ No I think he means the ssh applet, which, iirc, was an applet
              that implemented an ssh v1 client.  I think this page went away
2012/9/20-11/7 [Finance/Investment, Computer/SW/Unix] UID:54482 Activity:nil
9/20    How do I change my shell? chsh says "Cannot change ID to root."
        \_ /usr/bin/chsh does not have the SUID permission set. Without
           being set, it does not successfully change a user's shell.
           Typical newbie sys admin (on soda)
           \_ Actually, it does: -rwsr-xr-x 1 root root 37552 Feb 15  2011 /usr/bin/chsh
2012/9/24-11/7 [Computer/SW/Languages, Computer/SW/Unix] UID:54484 Activity:nil
9/24    How come changing my shell using ldapmodify (chsh doesn't work) doesn't
        work either? ldapsearch and getent show the new shell but I still get
        the old shell on login.
        \_ Scratch that, it magically took my new shell now. WTF?
           \_ probably nscd(8)
2012/3/29-6/4 [Computer/HW/Memory, Computer/HW/CPU, Computer/HW/Drives] UID:54351 Activity:nil
3/29    A friend wants a PC (no mac). She doesn't want Dell. Is there a
        good place that can custom build for you (SSD, large RAM, cheap video
        card--no game)?
        \_ As a side note: back in my Cal days more than two decades ago when
           having a 387SX made me the only person with floating-point hardware,
           most machines were custom built.
2012/4/27-6/4 [Computer/SW/Languages/Misc, Computer/SW/Unix] UID:54372 Activity:nil
4/27    I wrote a little shell script to collect iostat data:
        DATE=`date +%m%d`
        while true
2012/1/27-3/26 [Computer/SW/Unix] UID:54299 Activity:nil
1/27    Interesting list of useful unix tools. Shout out to
        cowsay even!
        \_ This is nice.  Thanks.
2011/10/26-12/6 [Computer/SW/Unix] UID:54202 Activity:nil
10/24  What's an easy way to see if say column 3 of a file matches a list of
       expressions in a file? Basically I want to combine "grep -f <file>"
       to store the patterns and awk's $3 ~ /(AAA|BBB|CCC)/ ... I realize
       I can do this with "egrep -f " and use regexp instead of strings, but
       was wondering if there was some magic way to do this.
       \_ UNIX has no magic. Make a shell script to produce the ask or egrep
2011/5/19-7/13 [Computer/SW/Languages/Misc] UID:54115 Activity:nil
5/19    If script A runs, and calls script B ..... is it possible for me to exit\
        script A based on results of script B and not continue?
        \_ assume any shell
        \_ Yes.
           \_ without passing the result to some stupid temp file?
              \_ It sounds like you want "scriptb || exit", which will run
2011/3/12-4/20 [Consumer/CellPhone, Computer/HW/Laptop] UID:54057 Activity:nil
3/12    I am curious what others think of tablets like iPad. They don't seem
        useful to me, but I use my computer for more than web browsing,
        Facebook, and Twitter. Why would I buy one instead of a laptop?
        They seem like a disabled laptop to me, but at a higher price.
        \_ You are most likely a coder.  iPad is not for coders.  They are
           what you get your non-technical friends.  Or musicians.  Look at
Cache (7617 bytes)
Linux So the other day I messaged another admin from the console using the regular old 'write' command (as I've been doing for over 10 years). To my surprise he didn't know how to respond back to me (he had to call me on the phone) and had never even known you could do that. That got me thinking that there's probably lots of things like that, and likely things I've never heard of. What sorts of things do you take for granted as a natural part of Unix that other people are surprised at? VIM tricks', it would be nice to see one on regular expressions and the programs that use them. What amazingly cool tricks have people discovered with respect to regular expressions in everyday life as a developer or power user?" Homepage Some more common ones I've thought of: screen - too useful, run apps in a virtual console which you can attach, deattach and share cd pwd -P - Jump into the real directory (from a linked directory). history - use it with grep if you forgot what you did strings - just show the printable strings from a file tail and head - tail -f is a lifesaver sftp - i really shouldn't need to explain this. Homepage Not quite the same, but in a similar vein, cat /dev/urandom > /dev/dsp Sometimes a quick white-noise machine is relaxing. Heck, I used that command in combination with 'at' to act as a makeshift alarm clock when I was just moving into my first apartment and had forgotten my only other electronic device with an alarm (my cell phone) at the office. Generally people are surprised by the fact that you could type some strange incantations into a black window like awk grep etc and make the computer do things without touching the mouse. And once I had this strange feeling that something was wrong with the CD drive of a machine I was working at in the console until I realized I was opening and closing the CD tray on a machine in another room! net that could process math expressions at runtime using Regex to get tokens from the expression. But after a code review, my pointy-haired manager made me comment each symbol in the regex. Someone needs to modify a file in a way that screams for regex search with replace, but is a nightmare in visual studio or some other windowy editor. So I have them stand behind me while I write an long, arcane-looking regex line in VI. When I press enter, the entire file instantly morphs into exactly what they want. I can think of no better way to justify my exorbitant bill rate. Homepage You'd be surprised how often I have seen experienced programmers manually type out long commands or directory paths, instead of using tab completion. Sometimes I have to restrain myself from ripping the keyboard from their hands and using tab to enter the path myself in a 10th of the time. Instead of finishing the word I was typing, it kept on moving the little "insertion line" thing to the right. I already filed a bug report, but do any of you have a quick fix? Step back for a moment and you'll find that "man pages" and "info" are actually a pretty awful way to distribute documentation. As a supplement they'd be fine, but as the main source of information on how to use many commands... The original Bell Labs man pages completely described the system from the point of view of an administrator or user. The current blight of wimpy, inaccurate and incomplete man pages seems to originate from the GNU developers who insist on using the terrible "info" crap, writing huge volumes of text with no real content, and the tradition is continued by Linux developers who generally provide little or no man page documentation -- presumably in the hope that users of their software will be tempted to ask questions on various mailing lists where they can be ritually disemboweled for displaying such a lack of understanding and disturbing the peace of the cognoscenti who have much more important things to do than answer questions of mere users of their software. Homepage I've seen Windows people go slack-jawed in astonishment as I ssh to the other side of the world and run X programs over forwarding. Some refuse to believe it, others shake their heads and walk away. com, port 456, via the remote host ssh -R lets you go in the opposite direction (tunnel from remote end to local end), but if your application supports SOCKS, it's even easier: ssh user@remotehost -D8080 Creates a secure tunnel supporting the SOCKS protocol. dd, device duplicator / disk destroyer mount, what I can't have a desktop icon? also managing disk volumes and the old conventions of /opt, /u, /usr, /usr/local This new fangled Linux craze with all of the UI tools is feeding it. Redhat is training admins that are dependent on a given release of their enterprise software (which I am a huge fan of) but not teaching them how it works under the hood. The one ray of hope seems to be a new generation hacking their bsd and linux based (iPhone/Android) phones and having fun in a somewhat embedded (but full blown) *nix environment. Homepage When I pop up with my laptop to discuss with a colleague, after a while I might do on their computer: xhost +mylaptopname and on my laptop I do: x2x thecomputername:0 -west Then suddenly my mouse can go over the two computers, my keyboard works on both as well, and I can even copy-paste between the two computers. For example: lsof /mnt/myMount That will list which processes have anything under /mnt/myMount open It's also useful to find who's accessing what device. For example, say you're trying to listen to an mp3 and Amarok bitches about the sound device not being available. In that case, you could do something like this (assuming you're using ALSA): lsof /dev/snd That will list what processes are accessing any of your ALSA sound devices. It's almost as if someone's first c program somehow got taken up as a part of standard Unix! Maybe in the days before sed and awk and perl it had some function in pipes that I can't grok, but nowadays other than making hints for video game websites I can't imagine what it's for. You're giving the shell an asterisk, which it dutifully expands. echo (which in this case is a shell builtin, but it doesn't have to be then just echoes them back. It works for anything, even commands that don't normally take files, or even with files that look like switches (conversely, if you want to treat all subsequent arguments as files, not switches, most programs have a '--' switch): $ ls a -l b c $ ls * -rw-r--r-- 1 marcansoft users 0 2008-11-05 21:58 a -rw-r--r-- 1 marcansoft users 0 2008-11-05 21:58 b -rw-r--r-- 1 marcansoft users 0 2008-11-05 21:58 c $ ls -- * a -l b c In the second example, ls sees "ls a -l b c" and takes -l as a switch instead of a filename. Homepage Optimized version of that: find / | grep -i $SOMETHING Even more optimized: find / -iname $SOMETHING However, most systems support locate/updatedb already, and that's much faster. For example, this is equivalent to your command above: find . I wanted to change the mime-type of all the xml files in my svn repository from "application/xml" to "text/xml": find . xml -exec sh -c "svn propget svn:mime-type {} | grep -q application/xml" \; Journal Xargs is much more fun with complex data processing. txt Oh, I almost forgot about one of my favorite tricks. Count the number of items: wc -l (paste the list into the window and then type CTRL-D) It even works when the list of items has oddities. Except that one of the blank lines wouldn't copy, so I actually needed (n+1)/2. echo $(($((wc -l+1))/2)) Want to make sure your sig is under 120 characters? Type "wc -c" in, paste it into your terminal, then press CTRL-D.