What programs I use

GNU/Linux distribution debian
web browser firefox
email mutt
email sync offlineimap
file sync unison
text editor emacs
shell bash
programming language python
math octave
window manager xfce (gnome and kde's are also good)

random utils:

sort -nr

Securing Debian by Bayle

NOTE: I am not a security expert. In fact, I know nothing about security! These tips have as much chance as accidentally being a "how NOT to manage security" as they have of being right. But this is what I did, for anyone interested.

1) Bible: I took as my Bible the document "Securing Debian". However, this document is much too long for many users.

If you are in charge of security for a production system, where security & uptime are critical, then it's probably worth the time to have someone read this document, all the others it recommends, and a few books (while you're at it, hire a seasoned security professional).

If you are a home user who wants to their system to be reasonably secure but who doesn't have time to become a security expert, then this document is a bit much.

I have a personal computer. I run a webserver off it, and I like to ssh in from various places, too. I will be upset if my computer is compromised, but I will be more upset if I fail out of school because I spent 6 months doing nothing but learning about computer security. This is in contrast to a corporate system, where the consequences of a compromise are dire enough to make it worthwhile to get it right.

I get the impression that due to the evolving nature of threats, making a system secure is usually a custom solution. That effective security is more of an attitude than a standard procedure that one can follow. However, I don't have the time to gain the knowledge to do this. I just want to be sure to do those things which most security experts think everyone should do. Those things for which security professionals would laugh at me for omitting. That is, take the intersection of all those customized solutions. I don't have time to be secure, so I'll settle for not being laughably insecure. And then, if there's a few other things I can do that are easy, I'll do those too.

Security-wise, I want to be just one step up from your mother.

So, here, I'll give you "the short list" of what I found most salient from the document:

Uninstall unnecessary packages (general principal) Block your ports! inetd netstat -an & netstat -a -p to check your ports install security updates frequently Bastille, tiger, snort. harden use bastille's firewall nessus logcheck or log??? some sort of MD5 database (aide?) for every service that you do offer to the outside world (i.e. a webserver? ssh?), read the appropriate section in the "securing services" section Appendix A & B

I got the sense that Bastille, especially, provided a lot of "hardening" in a convenient way.

debian tips


apt-get autoclean periodically, and also manually delete the biggest files that you don't want out of /var/cache/apt/archives

metaphors for linux:


A classic struggle in other ways. You've got the Stallman free-as-in-freedom model... This guy sees code as some kind of handmade luxury vehicle. Maybe it's a tank. And you've got Gates, who is the commercial industrialist robber baron. The Ford Model T... any color you like as long as darkness is the standard.


It's not even about "Fear Uncertainty and Doubt" any more. The flavor of it has changed. If you look at it, it's all about Fear Uncertainty and Hate. "Where do you want to go today ? to give us some money, OR ELSE?"

And the answer ? the popular American answer, really a kind of consumer uprising here ? is: "I wanna go steal some MP3s!" That's the answer. "I wanna go pirate some Hollywood movies and keep 'em for myself, please!" And the reaction is: "Gee, our customers are criminals! They must be spied upon, lest they hurt us, and one another!"


Microsoft Windows is slowly but surely becoming an armed terrorspace. It's like an airport. You go into an airport nowadays, it's really kind of amazing that the people who run them still expect you to spend money in there. They still pretend to you that you are this pampered jet-set consumer, instead of a captive under armed guard, which is what you are.

People in airports do horribly oppressive things to you. They go through your shoes, they empty your pockets. They confiscate various small but valuable items. "Where Do You Want to Go Today?" That's what they say in the airport, but there's this skeleton grin behind that question. There are men in camou with automatic weapons. There are surveillance cameras all over the place. You can't bring in your wife, your girlfriend or your grandmother without a ticket. You can't sob as you kiss your mother goodbye for the last time at the airport, because it's all on security tape. Then you wander into this rigid, bloated terrorspace, where, during every move and every action you undertake, it's presumed that you have swallowed dynamite and will cheerfully kill anyone you see.


And yes, that's also the contemporary computer system. The computer industry is really screwed-up now. There are razor-thin returns on investment, because you are no longer allowed to invent anything or genuinely surprise anybody. And if you do, that will be immediately swept up into Microsoft's operating system, or even Apple's dinky little operating system. The computer industry is losing tons of money now.

All that boasting about the largest legal creation of wealth in history... It's the largest semi-legal destruction of wealth in history. It blows my mind that these VC guys, who spent 20 years blathering about Ayn Rand capitalism, don't just admit that they live and work in a stagnant monopoly. What a bunch of limp-wristed sissies these captains of industry turned out to be, all these swaggering mercenaries so eager to punch out the bureaucrats in the free market. They're a race of slaves! They're like deer in the market's headlights, they creep around like mice.


The computer business wants to be really hot and sexy. It's like eavesdropping on a rich kid's affair with a supermodel. He's the user, he's the customer. He's eager, he's gullible. But she'd better be taut, hot, and totally glittering, or he'll pitch her right off the edge of the loading dock.

She's the vendor. She's this lean, mean, beanpole- tall jet-setter who's always heaving iron in her gym or preening before the cameras, screaming hysterically for next season's fashions. And as long as both of them don't know what's coming next -- as long as they can't outguess that, as long as they just plain don't know -- then they'll be as glamorous as all get-out. Just as long as their bubble of mutual infatuation has yet to burst.

Because in the information economy, everything important that happens is about the relationship. The information economy is about who promises what to whom. Behind the scenes, it's all about commitment.

The point is to make it harder to break up with me, the vendor, than it is to put up with my continual exploitation. There are basically six ways to do this. They get used in the information business all the time.

Number One. A contract. We'll put it on paper. We'll make it a legal, binding relationship. We somehow agreed that we really need each other in order to go on living. We stood in front of witnesses and we agreed to stick it out no matter what. That's normal, it's honest, it works. Unless it doesn't work, in which case it gets really nasty and leaves permanent scars.

Number Two. Brand-Specific Training. I'm really complicated and hard to figure out, but I give you something you just can't seem to get elsewhere. We spent endless days and nights talking over all my painful personal quirks and kinks, and getting all wrapped up in me and my needs. Now that you finally understand me, it just seems exhausting to throw me over and try to date somebody new.

Number Three. Search Costs. There's probably somebody else who would suit you as well as I do, but you're never going to find them ? not in a sorry little town like this, anyway.

Number Four. Information Formats. Nobody else can even speak our language around here. We've got a private argot of voodoo keyboard rituals. It's like a private lovers' baby-talk. If you try to ditch me and pick up somebody else talking that way, she'll look at you as if you came from Mars.

Number Five. Durable Purchases. You bought a huge mainframe and special scanners and printers, and a car and a fridge and a house. You can't just walk away from all that. Boy, can I ever make that cost you.

Number Six. Loyalty programs. I seem to like you better every time we go out together. I come up with all kinds of sweet little favors based on how well we're getting to know each other. Your Mom and Dad will love me. So will your friends and family. Look how thoughtful and generous I am with the people who can commit. Let's all get real, real cozy.

There are some other interesting aspects of this informational romance. They may not seem real technical ? you may not find them built into the hardware ? but these gambits all get people to pay big, expensive wads of money for information that wants to be free.

A. Branding and Reputation. Listen, baby: you can trust me. I've got breeding: my famous family of products has been around for generations. I'm just not that kind of guy! Why would I risk all that just to take advantage of you in this one little situation? Stick with the gold standard ? me and mine ? and save yourself a lot of heartbreak.

B. Standards-Setting. Everybody depends on me. I shoulder the grave responsibility of being reliable and predictable. I am the authoritative source through which all good things flow. The government smiles on me. So do international committees. If it doesn't work with my stuff, it just plain doesn't work.

C. Expectations Management. Also known as "Fear Uncertainty and Doubt." I know you're thinking of buying from that other vendor. But his stuff is hazardous and will injure you. Besides, I'm making one of those myself, just next quarter. Mine will be much better than his, and more people will use it, so you'll just have to buy it from me anyway, and plus, everybody will laugh at you. You'll lose your job. Look at the way I stepped on my competitors. I could step on you, too.

D. Creeping Featuritis. I'll add more and more "attractive" features to keep my jaded user intrigued. You like eye shadow? Lip gloss? Tattoos? Piercings? How about some latex and black rubber? Would a clown wig help?

E. Sell the Organization, Not the Information. Let's be very clear about this. I'm not selling you ones and zeros. You are hiring me as your grand vizier, because I have a deep cybernetic insight that is denied to lesser beings. I'm an indispensable part of your management team. Just give me your wallet, I'll look after all that.

F. Dubbed Local Versions. It's too hard to get a date in the English-language market, because they're all so cynical and sophisticated! But I'll be wonderfully glamorous if I take everything I learned and translate it into Hindi, Chinese and Malay.

Quite a spread, isn't it? You wouldn't think relationships could be so full of pitfalls!

And then ? there's the Open Source Model.


That Linux Girl. That little slip of a hippie girl.

She's barely noticed at first. She lives in a little trailer shack, and her address at MIT is 666 Infinite Corridor. She's got this mad geek stare in her eyes. She's got open arms, and a threadbare tank top, and unbuttoned jeans. Free Love, that's what it's all about for our Linux Girl. Free like freedom, free like beer, free like, whatever.

She's playing old, sentimental, Linda Ronstadt albums... "You and I travel to the beat of a different drum"... Love, Peace, and Linux...

"I love geeky guys," says the Linux Girl. "All geeky guys, I love ALL geeky guys. And I'm not ready to settle down. EVER!! I don't do that AT ALL!! Washing your socks, ironing your shirts, HA HA HA, let me offer a light little hippie-girl laugh here! Just cruise on by the trailer, handsome! I'll take my clothes off. No, it's better than that. I'll take my RIBS off! You can see RIGHT THROUGH ME! I've got nothing whatever to hide! I am open all the way through!"

The A&R guys from the industry are dropping by... "We may have a star here boys, I'm liking this Janis Joplin thing... But wait a minute, Janis here doesn't do anything but free concerts! And I guess her code looks pretty tight and shapely, but her body is completely transparent! You can't get anybody to pay to see a woman sing when her body is clearer than glass! It kinda defeats the whole purpose, really! It's like some kind of totally academic thing she's got going on here! She's like the Visible Woman! There's something creepy and medical about her..."

Free Love as a policy is sort of okay. I mean, people will kinda overlook it when you're young... Because they expect you to die, of VD or AIDS or something! But the Linux Girl just laughs at viruses. "HA HA HA! Only debutantes from Redmond get viruses!"

And then she starts having children. Any guy's children. She'll have your child, as long as you're not particular about giving it your name. She's got a whole brood of kids, like Sendmail, and Postfix, and Apache, and Perl. And some of 'em die young, and some are mentally retarded. But the hippie earth mother is just hitting her stride here. She's a one-woman demographic boom! She's having litters of kids, kids by the dozens.

Cops are coming around, and stuff... "Is this your trailer park, ma'am?"

"Not really, officer!"

"Could we see some ID, please?"

"I never bother much with any official papers!"

"Are you from around here, ma'am? You don't look very American."

"Actually, I'm Finnish, officer! Look at this old birth certificate!"

"We'd better run her in for questioning.... Whoa! I can't even get a grip on her! It's like pitchforking mercury! It's like she's made outta mirror sites!"

And the guys from Redmond come by and roll down the smoked glass in the back of the limo... "She's DISGUSTING! She's a cancer on our community!"

Now the very earth is starting to crack where this woman walks... She's as big around as a bus! She's got children in places other business models can't go, places they've never even heard of! She's got children like... Red Flag Linux.

This Chinese kid, in a little Mao suit. "Thank you for the free software, Mother! We will destroy the running dogs of Wall Street now!"

"No problem, Red Flag, they're doin' it to themselves! He's such a polite and disciplined little boy, my Red Flag Linux!"

And then there's the Simputer. He speaks Telugu and Hindi and Urdu, and he costs only two hundred bucks!

"I love you Mom! I am the future, Mom! Demographics and birth rates are on my side, Mom! My new President is an atomic rocket scientist Mom! Someday you will die, Mom, and I take you to the Tower of Silence for a Parsi funeral where the vultures will eat your flesh, and then the future of computing will be mine as far as the human eye can see!"

"HA HA HA, oh my Simputer boy, he's so imaginative!"

In conclusion: these are some pretty hard times.

--- neil stephenson

Imagine a crossroads where four competing auto dealerships are situated. One of them (Microsoft) is much, much bigger than the others. ...

Eventually the big dealership came out with a full-fledged car: a colossal station wagon (Windows 95). It had all the aesthetic appeal of a Soviet worker housing block, it leaked oil and blew gaskets, and it was an enormous success. A little later, they also came out with a hulking off-road vehicle intended for industrial users (Windows NT) which was no more beautiful than the station wagon, and only a little more reliable.

Since then there has been a lot of noise and shouting, but little has changed. The smaller dealership continues to sell sleek Euro-styled sedans and to spend a lot of money on advertising campaigns. They have had GOING OUT OF BUSINESS! signs taped up in their windows for so long that they have gotten all yellow and curly. The big one keeps making bigger and bigger station wagons and ORVs.

On the other side of the road are two competitors that have come along more recently.

One of them (Be, Inc.) is selling fully operational Batmobiles (the BeOS?). They are more beautiful and stylish even than the Euro-sedans, better designed, more technologically advanced, and at least as reliable as anything else on the market--and yet cheaper than the others.

With one exception, that is: Linux, which is right next door, and which is not a business at all. It's a bunch of RVs, yurts, tepees, and geodesic domes set up in a field and organized by consensus. The people who live there are making tanks. These are not old-fashioned, cast-iron Soviet tanks; these are more like the M1 tanks of the U.S. Army, made of space-age materials and jammed with sophisticated technology from one end to the other. But they are better than Army tanks. They've been modified in such a way that they never, ever break down, are light and maneuverable enough to use on ordinary streets, and use no more fuel than a subcompact car. These tanks are being cranked out, on the spot, at a terrific pace, and a vast number of them are lined up along the edge of the road with keys in the ignition. Anyone who wants can simply climb into one and drive it away for free.

Customers come to this crossroads in throngs, day and night. Ninety percent of them go straight to the biggest dealership and buy station wagons or off-road vehicles. They do not even look at the other dealerships.

Of the remaining ten percent, most go and buy a sleek Euro-sedan, pausing only to turn up their noses at the philistines going to buy the station wagons and ORVs. If they even notice the people on the opposite side of the road, selling the cheaper, technically superior vehicles, these customers deride them cranks and half-wits.

The Batmobile outlet sells a few vehicles to the occasional car nut who wants a second vehicle to go with his station wagon, but seems to accept, at least for now, that it's a fringe player.

The group giving away the free tanks only stays alive because it is staffed by volunteers, who are lined up at the edge of the street with bullhorns, trying to draw customers' attention to this incredible situation. A typical conversation goes something like this:

Hacker with bullhorn: "Save your money! Accept one of our free tanks! It is invulnerable, and can drive across rocks and swamps at ninety miles an hour while getting a hundred miles to the gallon!"

Prospective station wagon buyer: "I know what you say is don't know how to maintain a tank!"

Bullhorn: "You don't know how to maintain a station wagon either!"

Buyer: "But this dealership has mechanics on staff. If something goes wrong with my station wagon, I can take a day off work, bring it here, and pay them to work on it while I sit in the waiting room for hours, listening to elevator music."

Bullhorn: "But if you accept one of our free tanks we will send volunteers to your house to fix it for free while you sleep!"

Buyer: "Stay away from my house, you freak!"

Bullhorn: "But..."

Buyer: "Can't you see that everyone is buying station wagons?"


unix tips: fileutils textutils "script"

security notes (from a slashdot post by someone else):

3 of 4: 9+ charaters, 3 of 4 ({CAPS, lower, 1234, !@#$

deny by default" or "defense in depth".

 Always know exactly what ports you have open.Dont let any attachments in. Have DMZ's. Pay attention to bugtraq and errata postings. Nmap every once in a while. Only have two ssh's open to get in and have the IPs defined in hosts.allow. ALWAYS upgrade when security bugs are fixed. Have snort on the main DMZ in a promiscuous switch port, get some nice looking reports going. Pay attention to bandwidth useage ( cricket ). Add a dash of portsentry+tcpwrappers. Dont act macho and send nasty letters to people who try to get in. Maybe, dont return pings ( tcp-reset ) or portscans. Bind 9 with zones. Check all logs all the time (3 times a week). KISS = keep it simple stupid. Dont hire lazy admins. Try out all new security related programs. I SHOULD be sending most all logs to a central host. Make sure MS admins dont totally let their guard down.

Oh and dont enable web crap on routers etc (more ports open). ssh for everything. shut down telnet. https for everything. Try to protect email, imap, pop (plaintext over the network). Read the "security section of all apps you install and try to KISS ummmmmmmm, thats about it for me.

everyone already knows this but im just throwing in my 2 cents :-)

portsentry, tcpwrappers

tiger, snort, nessus, logcheck, harden

 complexity is the enemy of security


has many helpful tips

--- a comment of SOMEONE ELSE's (phil gregory) on slashdot:

I live in text mode. Here's a selection of my preferred apps. Most of these are still in active development (though some are more active than others).

screen. Simply indispensable. It slices and dices console sessions. Pretty much everything I do, I do in screen. I've a page elsewhere that describes everything screen does for me.

zsh. My shell of choice. Think of all the good features of bash, ksh, and tcsh rolled together. (Without much of the ickiness, particularly the csh heritage.) Personally, the killer application of zsh was that fact that not only did it have context-sensitive completion but (unlike tcsh) it shipped with hordes of completion definitions right out of the box. Type 'dpkg -L fo<tab>' and zsh will autocomplete on the Debian packages currently installed on your system. With an ssh-agent running, type 'scp otherhost:fo<tab>' and zsh will ssh to the other system and autocomplete on the files available on that host.

irssi. The best IRC client I've come across, certainly beating out IrcII?, BitchX?, and even epic. Multiple windows, extensible, tons of plugins available.

bitlbee. This is actually an IRC-to-Instant-Messaging gateway. It allows me to use irssi and the IRC environment with which I am so familiar to also deal with those of my friends and family who insist on using the various IM services.

snownews. curses-based RSS aggregator. I shopped around a bit before finding an aggregator that I liked. snownews does everything I need.

mutt. Possibly the best mail client around, GUI or not. While pine is okay (and simpler to use), mutt is much more customizable and scales better to large volumes of email.

procmail. Again, not exactly command line, but essential to my email usage.

Emacs. My text-mode editor of choice. Feel free to substitute XEmacs or vi (preferably vim) at your own preference. I prefer emacs to vi, though I know a decent amount of vi, as any sysadmin should. I actually like XEmacs a little better than GNU Emacs, but GNU Emacs has better UTF-8 support.

w3m. There's also links; I'm not tremendously familiar with it because w3m fills all of my needs and it used to be the case that w3m had better HTML support than links, but I don't believe this is any longer the case. Of note is the fact that w3m can do tabbed browsing, though it's not multithreaded, so you can't read one tab while another is loading. Also, if you run w3m with a valid $DISPLAY, it can even show images in the pages it displays.

moosic. This is a music jukebox. The features that distinguish it from other such programs are twofold. First, it runs as a standalone server; you interact with it via a command line client. (In theory, a curses or GUI client could be written, but to my knowledge none yet has.) Second, it's customizable with regards to how it plays music. It has a config file where you tell it what programs to use to play various music formats (it does come with reasonable defaults). Someone elsewhere in this article pointed out mpd; I'll have to look at that, but it at least doesn't appear to support the various MOD formats.

mplayer. It does more or less require some graphical output (X, framebuffer, whatever), but it's run and displays it status in text mode. And it plays pretty much everything.

surfraw. surfraw is a collection of command-line based jumping-points to various web-based information, mostly searches. For a quick google search, I need only go to a command line and type 'sr google my search terms'. (Debian calls all of the surfraw "elvi" from a single program, 'sr'. On other systems, you would probably just run 'google your search terms'.)

wget. The swiss-army-knife of grabbing things off the web (and via FTP). I've automated many downloads, some tweaked in interesting ways, with wget.

tdl. Completely command-line todo list manager. Some people prefer DevTodo?; I haven't really played with it because tdl does everything I need.

A bunch of others, most of which you've probably heard of. In roughly the order that popularity-contest lists them on my home desktop: less (pager), mpg321 (mp3 player), GnuPG? (OpenPGP? implementation), aumix (volume control), teTeX (TeX? implementation), pal (nice colored calendar with a number of features), bc (simple command line calculator), dict (actually a dictionary network protocol, but their command-line client is also named 'dict'), mp3gain (normalization of mp3s (ideally should be done non-destructively via ID3v2, but no one supports that)), netcat (connect directly to TCP sockets), BitTornado? (bittorrent client; slightly nicer than the standard one), cvs (source revision control; also see subversion), abcde (CD ripper), lame (MP3 encoder), nmap (portscanner), hping (packet generator), and tcpdump (packet sniffer).

For the record, there are a couple of GUI programs that I can't live without, despite my devotion to text-mode ways. Ethereal is hands-down the best network sniffer and analyzer I've come across. tcpdump is good for simpler stuff, but ethereal can do more analysis and has excellent packet-dissecting facilities. (Yes, there's tethereal, but it's never worked very well for me.) GnuCash? is a much better asset management program than anything I've found for the command line.

xhost +local:

allows all local users to access your xserver (i.e. to put windows on your screen and grab your keystrokes)

or, the other local user can do:

export XAUTHORITY=/home/userThatStartedX/.Xauthority

or, if you always want two users (say, root and bshanks) to use the same Xwindows:

ln -s /home/bshanks/.Xauthority /root/

(if the second user is not root, you'll also have to give the other user permission to manipulate the .Xauthority)

if you get "cannot overwrite existing file" in the shell, you can turn off this feature (called "noclobber") with set +o noclobber


wgetting stuff from internet archive:

DOMAIN=$YOUR_DESIRED_DOMAIN_NAME; URL=$DATE_AT_INTERNET_ARCHIVE/$DOMAIN/$YOUR_DESIRED_PATH; wget --exclude-domains $DOMAIN -e robots=off -nH --cut-dirs=2 --base=$URL -r -l 1 -N -k -p -R js $URL --span-hosts --wait 5 --random-wait

wgetting a bunch of stuff with numbers in the URL: for i in {682816 681914}; do sleep 5; wget -p -k http://$YOUR_URL/index.php?p=$i; done


"The command "nm" lists symbols contained in the object file or shared library. "


grep '/YOUR_PAGE' access_log

grep -v bot grep -v scoutjet grep -v slurp grep -v spider grep -v crawler grep -v '"-"'


upgraded xorg. keyboard got screwed up. reset all my keyboard shortcuts in xfce. now it mostly worked, but the "3" key mapped to "enter", and "1" and "2" keys didn't do anything. upgraded hal stuff and xkb-data (i think xkb-data was the important one) packages. then it worked.


shell tips



cd goes home. cd - goes to prev dir

alterecco says: 2010/04/04 at 12:57 pm

for command binding to keystrokes on linux

in $HOME/.inputrc (defines readline keybinds)

“\eOA”: “pushd\n”

For me, this binds Ctrl-Up to pushd followed by a newline. To get the sequence to use for the keybind press Ctrl-V in your terminal followed by the keystroke you desire. Replace ^[ with \e and you should be good to go. To reload your .inputrc in an existing terminal window, press Ctrl-x Ctrl-r.

For more info on readline magic, see `man readline`

This article and its responses, particularly Nico’s, has inspired me to experiment with modifying the CDPATH, which both cd and pushd use.

Here’s an example of what I’ve come up with. I show the CDPATH, try to pushd to FileMaker?, which fails. Then I add the path to FileMaker? to the CDPATH, after which, pushd now works.

$ printenv CDPATH .:/Users/ge:/Users/ge/Desktop:/Users/ge/Documents:/Users/ge/Documents/Politics:/Library/WebServer?/Documents:/Users/ge/Documents/ruby_and_rails/rails/projects $ pushd FileMaker? -bash: pushd: FileMaker?: No such file or directory $ cdppush ~/Documents/tech/ $ pushd FileMaker? /Users/ge/Documents/tech/FileMaker? ~/Documents/tech/FileMaker? ~/Documents/tech/FileMaker? ~/.profile.d

I created two functions in a file that I source from bash to implement these functions: The names could be better.

function cdppush() { set +o nounset

  1. echo “$# args”; if [ "X${1}" = "X" ]; then
  2. echo “cding to home”; builtin cd; else
  3. echo “adding ${1} to CDPATH”; CDPATH=”${*}” CDPATH=$CDPATH:. CDPATH=$CDPATH:$HOME CDPATH=$CDPATH:$HOME/Desktop CDPATH=$CDPATH:$HOME/Documents CDPATH=$CDPATH:$HOME/Documents/Politics CDPATH=$CDPATH:/Library/WebServer?/Documents CDPATH=$CDPATH:$HOME/Documents/ruby_and_rails/rails/projects export CDPATH echo “added ${1} to CDPATH [$CDPATH]“; fi }

function cdpreset() { CDPATH=. CDPATH=$CDPATH:$HOME CDPATH=$CDPATH:$HOME/Desktop CDPATH=$CDPATH:$HOME/Documents CDPATH=$CDPATH:$HOME/Documents/Politics CDPATH=$CDPATH:/Library/WebServer?/Documents CDPATH=$CDPATH:$HOME/Documents/ruby_and_rails/rails/projects export CDPATH }

It can’t do pattern searches but it should be easy to remember to say ‘pushd Documents’ for example.

simonmar says: 2009/01/17 at 1:23 am

I’ve been using this scheme for years now. cd = pushd, b = go backwards (popd), f = go forwards (kind of like “unpopd”).

alias b='pushd +1' alias f='pushd -0'

cd () { if [ "$*" = "" ]; then pushd $HOME >/dev/null else pushd "$*" >/dev/null fi }

I use a much better abstraction that I co-authored with Will Fiveash:

This way I can “save” directories and recall them using sub-string (actually, glob) matching, and I can list them, remove them, …

% pwd / % cd /tmp /tmp % cdinit % cdsv % cdto foo % cdto ../bar % cdto foobar/baz % cdls 0 /tmp 1 /tmp/foo 2 /tmp/bar 3 /tmp/foobar/baz % cdto 0 /tmp % cd / % cdto foo /tmp/foo % cdto baz /tmp/foobar/baz % cdto bar /tmp/bar %

And you can save listings to files and source them back. Very handy for working in large source projects. E.g., I can say “cdto ssh” and instantly I’m in $SRC/cmd/ssh” in a shell where I’m working on OS/Net Nevada.

Add to your .bashrc:

  1. Fan of directory stacks. alias d=”dirs” alias pu=”pushd” alias po=”popd” alias 1=”pushd” alias 2=”pushd +2″ alias 3=”pushd +3″ alias 4=”pushd +4″ alias 5=”pushd +5″ alias 6=”pushd +6″ Reply

Eric Wendelin says: 2009/01/16 at 12:41 pm

@Joseph: You might be able to use bash ‘history’ to do some of what you ask. You could also do: alias z=’pushd . && popd’ to try keeping your dir stack nicely populated.

You’re exactly right about ‘cd -’, it’s just like the Recall button.

If anyone else has other solutions, I’d love to hear them.

intro to pushd and popd:

Brian Holtz 5/15/2005 at 8:58 am

Your solution is the nicest I’ve seen for the problem of directory bookmarks. However, I think the notion of history needs to be per-shell, not global across all shells. For directories, a $DIRSTACK-style working set is probably more useful than a strict browser-style history, so I extended your solution by adding:

    support for pushd’s $DIRSTACK , the Nth entry of which is accessed via cd N
    searching $DIRSTACK and the directory bookmark targets via regular expressions
    fallback support for $CDPATH if the above fail
    support for symlinks by prepending $PWD instead of using realpath
    resolution of bookmark collisions in favor of more recent bookmark
    not bookmarking directories when reached via short hops e.g. cd ..
  1. cd [dir
  1. if arg is a directory, then
  2. if arg has > 2 slashes, then
  3. bookmark dir and pushd there
  4. else
  5. cd there
  6. else if arg is a number N
  7. cd to Nth entry of $DIRSTACK
  8. else if arg is a substring in $DIRSTACK
  9. cd to first matching entry
  10. else if arg is a substring in bookmarks
  11. cd to newest matching entry
  12. else
  13. attempt to cd to arg using $CDPATH cd () { if [ "$*" = "" -o "$*" = "-" ]; then builtin cd ${1+"$@"} return fi local target if [ -d "$*" ]; then slashes=${1[^\/]} # deletes all non-slashes if [ ${#slashes} -gt 2 ]; then pushdir "$1" return fi fi
  14. if the non-numeric part of $1 is empty... if [ -z "${1[0-9]}" ]; then
  15. ...then go to Nth DIRSTACK entry target=`builtin dirs -l +"$@" 2> /dev/null` fi if [ -z "$target" ]; then target=`builtin dirs -p -l
grep -i "$1"head -1`
	if [ -z "$target" ]; then
		target=`dirz -t | grep -i "$1" | head -1`
	if [ -z "$target" ]; then
	if builtin cd $target; then : else
		echo "Also no match in DIRSTACK or ~/dirs" > /dev/stderr
  1. pushdir dir - pushd dir after bookmarking via a symlink in ~/dirs pushdir () { local dest="$1"
  2. if relative, prepend PWD if [ "${dest:0:1}" != "/" ]; then dest="${PWD}/${dest}" fi
  3. ln confused by trailing slash, so delete dest=${dest%/} ln -sf "$dest" ~/dirs builtin pushd "$dest" > /dev/null }
  4. dirz [-t] - list bookmarked dirs sorted [by time] dirz () { local ordercmd=sort if [ "$1" == "-t" ]; then ordercmd=cat; fi /bin/ls -lt ~/dirs
tail +2sed 's/.* -> '$ordercmd

sudo apt-get remove firefox-globalmenu

to correct

(didnt help for me)

reptyr is an invaluable program that lets you reattach a process to a different terminal. This is useful if you forgot to run something under GNU screen, and now you need to access it from a different terminal from the one it was started on.


i switched from Ubuntu Unity to xubuntu's xfce4 today by doing

sudo aptitude install xubuntu-desktop

and then logging out and selecting xubuntu for my session type and then logging back in

so far i am very happy with it. Unity would crash every now and then.


getting a session-wide ssh agent (a graphical password dialog prompt like the one in Ubuntu Unity) in xubuntu: put the following in your ~/.profile :

export `gnome-keyring-daemon --start`

(thanks Lars Seine Seite )





nikcub 1 day ago

You can add a section 0 to man pages for example (tldr) versions. Man also already supports rendering HTML if that is the preferred format that contributors want to write.

With a handful of commands i've got the tldr pages rendering in man:

    mkdir /usr/local/share/man/man0/
    pandoc -f markdown_github -t html > /usr/local/share/man/man0/tar.0.html
    export MANPAGER="`which lynx` -stdin"
    man 0 tar

--- " If you want a fast way to read the EXAMPLES section only for a command, here is a shell function which creates an ‘eg’ command which only displays the “EXAMPLES” section of manual pages:

      MAN_KEEP_FORMATTING=1 man "$@" 2>/dev/null \
          | sed --quiet --expression='/^E\(\x08.\)X\(\x08.\)\?A\(\x08.\)\?M\(\x08.\)\?P\(\x08.\)\?L\(\x08.\)\?E/{:a;p;n;/^[^ ]/q;ba}' \
          | ${MANPAGER:-${PAGER:-pager -s}}


  $ eg tar
       Create archive.tar from files foo and bar.
             tar -cf archive.tar foo bar
       List all files in archive.tar verbosely.
             tar -tvf archive.tar
       Extract all files from archive.tar.
             tar -xf archive.tar
  $" --


an open source antivirus for GNU/Linux is 'clamav'


instead of middle-clicking to insert into an xterm, you can also use shift-insert


Ubuntu tips

--- is surprisingly helpful even for non-Arch Linux GNU/Linux distributions


crontab format cheatsheet: