What's Your Command Line Judo?
lousyd asks: "We all have our CLI amor. That two- or three-letter command that fiddles our heartstrings. 'mv' is pedestrian, but 'mmv' is so cool. 'cp' can lug bits around all day to no applause, but 'cpio' will excite even the most jaded of command line linguists. 'How perfect!' you exclaim. So what's your poison? What turns you on? What little known command performs just the right function for you?"
Justifies nicely said paragraphs; provides lists and sigart.
ls -t | head
This is nice for listing the 10 most recently modified files. Usually the one you want is the first or second one.
7 November 2006: The day Americans realized corruption and incompetence weren't addressing 11 September 2001
I wish the behavior was the same in bash, but for some reason they chose to make it clear the screen instead.
Second that. "Traditional" Unix tools sometimes just don't cut it (or they do, but requires significantly longer typing and multi-piping work).
I use this all the time:
$ perlrename -e's/.\[www.descargasweb.net\]//' *
$ perlrename -e's/.\[www.\S+?\]//' *
$ perlrename -e'$_=lc' *
$ perlrename -de's/Sex And The City - S(\d+)E(\d+)/SATC - $1$2/ig' Sex*
etc etc
where perlrename is a 30-something perl script.
Based on the rsync protocol, unison can maintain a bi-direction file sync. I use it to sync my personal data between home and co-lo'ed server, and work and co-lo'ed server. I can update files in any of the three locations and they'll be replicated across all three.
-buf
try ls -F | grep /
./*` to show how much room each file takes up, and it adds up directories also--just like 'calculate folder sizes' has done in Mac OS for a decade.
'-F' shows a slash after each entry that's a directory, an asterisk after each executable, and some other things. Read the man page for 'ls' sometime, it's like a whole freaking operating system.
NAME
ls - list directory contents
SYNOPSIS
ls [-ABCFGHLPRTWZabcdfghiklmnopqrstuwx1]
By the way, my favorite script fu is `du -sh
Dear Slashdot: next time you want to mess with the site, add a rich-text editor for comments.
I actually use a shell script in my .bash_logout that appends my .history file to a master "history" file. It's helped me numerous times when I've need to recall a command I ran ages ago. I just use grep succesively until I find the obscure command string.
I don't mean that I was looking for a single command; I use bash pretty hardcore, and I've used pipes to do some pretty extensive things - that's where I think history has it's greatest use.
(and yes, I'm using bash 3 and my HISTSIZE envvar is set to 10000)
Don't think that a small group of dedicated individuals can't change the world. It's the only thing that ever has.
Oh a couple more good simple ones popped into my head for beginners:
Use "&&" between commands, and the second command will only execute if the first command succeeded. For example:
make && make install
That will only run the "make install" if the "make" succeeded (which is kinda contrived, since for most packages a simple "make install" would have done the same all on it's own).
And also, did you know that you can group commands with parentheses, and you can pipe into parenthesized groups of commands? Piping into a group of commands will send the pipe data to the first command in the group that actually wants it. You can copy a directory over from one place to another using tar all in one line like so:
tar -cf - . | (cd
The two tar commands are simply piping a tar-format file between them without using the disk, and the second tar runs with it's current directory set to
11*43+456^2
'mc' is your gateway to a much more powerful shell. Combine your command line shell with quick changing to bookmarked dirs (ctrl+\); easy adding to that via alt+a; F2 menus that let you easily compress subdirs, or run other things from your actions file based on the mime-type or file pattern; two-panes at two different FS locations; undelete FS, FTPFS, and other meta-FS interfaces; good mouse support; built-in editor (Cool edit); prompts you for arguments for makefiles you hit enter on...
The list goes on. Midnight Commander is a shell designed to speed up all your common tasks. It has sane defaults you don't really have to change much. It'll make you more productive!
--
Internet Explorer (n): Another bug -- that is, a feature that can't be turned off -- in Windows.
Yea, Though I compute through the user interface of the shadow of death, I shall fear no evil, for ZTree is with me.
No joke - ZTree is a character for character re-write of an old utility called XTree Gold v2.0 or 2.5 - and it is by far the most effective and influential interface between me and my data. The entire file system is but an extension of my mental processes, and I can slice and dice through the multi-dimensional (time, space, attributes, multi-layered directory structure, multi-drive architecture,) in effect creating a virtual directory within which I control the parameters driving what is listed, in what order - then copy, view, move, delete, diff (file compare), view in hex mode (and edit it in hex mode), search for text in lists of files, compare directory trees for like or different files (binary, time stamp, etc.)
It is totally CUI, about like Midnight commander but a ton better. Take time to get fluent in ZTree (UnixTree for Unix / Linux, a bit older with a few quirks, but still pretty damn good) and you will be like the guys in the Matrix sitting at their green screen terminals.
ZTree Don't leave $HOME without it.
Glonoinha the MebiByte Slayer
Hello Robert.
.cshrc, I have this:
.cshrc and it will work for just that session.
My name is Alan, no reference to Tron
in my
alias lh "ls -lt !* | head -15"
alias lt "ls -lt !* | more"
alias hog "ps -eo pcpu,vsz,args,time | sort -rn | head -11"
alias ff "find . -name !* -print"
I use these and many more when I'm working on the newspaper.
You can type these aliases on the commandline if you don't want to add them to your
So then I type lh in the CLI and it shows the newest 15 files - you can change that number to whatever you like.
Daily News http://newsblaze.com
...but it's limited to JP Software shells (4DOS, 4NT, 4OS2), and the authors of Linux shells don't seem interested in implementing it.
.ZIP files as potential targets.
SELECT is a command which provides a fullscreen point-and-shoot file selection interface for other commands, allowing for the easy arbitrary selection of target files (point-and-shoot) in command aliases or batch/script files. In essence, it provides a mini filemanager interface which can be used to select the targets for *any* command on the command line, used in aliases, etc.
Some simple examples (from my 4OS2 alias file) are as follows:
TCOPY=select copy (*.*) %1
TMOVE=select move (*.*) %1
TDEL=select del (*.*)
TRUN=select %1 (*.*)
TEDIT=trun fte
TLIST=trun list
UNZ=f:\unz.cmd
TUNZ=select unz (*.zip)
The filespec in parenthesis limits the files which appear in the selection list, so the TUNZ command will only show
Mainframe/UNIX Bit Twiddler and long time Windows/Linux Hobbyist.
The Theorem Theorem: If If, Then Then.