Live data from Hacker News

Lazy Linux: essential tricks for admins

ibm.com

31–40 of 54 posts

Re: Lazy Linux: essential tricks for admins

#31
post #25
post #24

Earlier quoted context omitted.

See the thing is that if you're knee deep in an unfamiliar system trying to fix it you type "ls" about a dozen times a minute. Adding two unnecessary keystrokes (doubling the length!) not only adds up it makes typos more common. There are some nice conventions though, once you know grep there's egrep, ngrep, etc. Then there's the -stat family, prstat, iostat, vmstat, mpstat, etc. Grep is its own special case, I'm not…

palish has a point to the extent that lsof is so infrequently used that it would do no harm to give it a more descriptive name. Nonetheless, I entirely agree with you about ls, and about sticking to the conventions that have developed around unix.

There's a tribal aspect, too; not to mention jargon as a barrier to entry. And what professional wants to forgo hard-won knowledge?

That said, I kind of like the weird names, esp grep. (Wasn't that in Stranger in a Strange Land or something?)

But I do object to inconsistent options. One example is: mkdir -p a/b/c This will make all three nested directories, if needed; but there is no equivalent: mv -p x a/b/c/y There also isn't: cp -p a/b/c [1]. You have to create the nested destination directories (a/b/c) first.

[1] cp has a -p option, but with a different meaning...

BTW: It would be nice if HackerNews had the `` markdown of Reddit for inline code. There's been a bit of code sharing recently, and I like that in a "hacker" site.

Re: Lazy Linux: essential tricks for admins

#32
To get back a hosed screen, also try:

stty sane ^j

(That's Ctrl-j there.)

You might be flying blind, but just do it and you might get your screen back.

You probably know this, but to rescue a hosed system with Knoppix or similar live-cd:

- Boot from CD.

- Open root console.

- Mount your usual root partition: mount -t somefs /dev/hda1 /mnt/oldsys

- chroot /mnt/odlsys /bin/bash

Showed that to another admin who'd lost a production box, and his chin kind of hit the floor :) I gifted him the Knoppix disk... You can also use that to reset passwords (as per the article), by editing /etc/shadow or /etc/passwd in the /mnt/oldssys directory.

Re: Lazy Linux: essential tricks for admins

#33
post #31
post #25

Earlier quoted context omitted.

palish has a point to the extent that lsof is so infrequently used that it would do no harm to give it a more descriptive name. Nonetheless, I entirely agree with you about ls, and about sticking to the conventions that have developed around unix.

There's a tribal aspect, too; not to mention jargon as a barrier to entry. And what professional wants to forgo hard-won knowledge? That said, I kind of like the weird names, esp grep. (Wasn't that in Stranger in a Strange Land or something?) But I do object to inconsistent options. One example is: mkdir -p a/b/c This will make all three nested directories, if needed; but there is no equivalent: mv -p x a/b/c/y There…

For code, use two spaces at the start of the line.

  like this

Re: Lazy Linux: essential tricks for admins

#34
post #31
post #25

Earlier quoted context omitted.

palish has a point to the extent that lsof is so infrequently used that it would do no harm to give it a more descriptive name. Nonetheless, I entirely agree with you about ls, and about sticking to the conventions that have developed around unix.

There's a tribal aspect, too; not to mention jargon as a barrier to entry. And what professional wants to forgo hard-won knowledge? That said, I kind of like the weird names, esp grep. (Wasn't that in Stranger in a Strange Land or something?) But I do object to inconsistent options. One example is: mkdir -p a/b/c This will make all three nested directories, if needed; but there is no equivalent: mv -p x a/b/c/y There…

Grok, you're thinking of.

Re: Lazy Linux: essential tricks for admins

#35
post #33
post #31

Earlier quoted context omitted.

There's a tribal aspect, too; not to mention jargon as a barrier to entry. And what professional wants to forgo hard-won knowledge? That said, I kind of like the weird names, esp grep. (Wasn't that in Stranger in a Strange Land or something?) But I do object to inconsistent options. One example is: mkdir -p a/b/c This will make all three nested directories, if needed; but there is no equivalent: mv -p x a/b/c/y There…

For code, use two spaces at the start of the line. like this

thanks, I know. I referred to inline code.

Re: Lazy Linux: essential tricks for admins

#36
post #6

Trick 5 (opening a remote port on a "public" machine to connect back to your local machine) is great. Combine it: office$ ssh -R 9999:localhost:22 user@home ## do this in a screen for good measure and another lesser known ssh feature: home$ ssh -D 8888 -p 9999 user@localhost and now you have a SOCKS proxy on home:8888 that will access everything visible to the computer named "office". For extra credit add PingTunnel…

combine your ssh-tunnel-socks-proxy with tsocks, and you have a nearly transparent access for your applications on your home-box into the office.

Re: Lazy Linux: essential tricks for admins

#37
post #18
post #11

Any admins care to share some pornographic passwords? p4ss1ng g4s 1n h3r 4ss w/ my sp34r d4n4 d03s d1ld0s @t d4 d1ld0 st0re d1ck r4p3d j4n3 w/ h1s d1ng d4ng

My general attitude to passwords is "Never choose something you'd be ashamed to recite to your mother over the phone", since you never know when you'll be in a position where you may have to do exactly that.

As an information assurance guy, I'd encourage users to use the most embarassing possible passwords, since you should never share them. If you need to make resources available to more entities, do it by sharing access, not authentication.

Re: Lazy Linux: essential tricks for admins

#38
post #23
post #20

Earlier quoted context omitted.

You mean booting to singleuser? If you don't want it just use a grub password; nothing to do with CentOS.

Is the procedure for changing the root password with grub the same regardless of the flavour of Linux?

The primary bootloaders for Linux distributions are http://en.wikipedia.org/wiki/GNU_GRUB and http://en.wikipedia.org/wiki/LILO_(boot_loader) with a large edge in popularity to GRUB these days. Unless it's a fork or modification, GRUB works like this: http://www.gnu.org/software/grub/manual

Single User Mode isn't unique to CentOS/Redhat, or even Linux. In fact, the concept behind it isn't even unique to Unix: One of Microsoft's 10 security rules is "if the bad guy has unrestricted physical access to your box, it isn't your box anymore."

edit for clarity, due to reply

GRUB doesn't change the Unix root password. GRUB--like any other bootloader--lets you boot to single user mode, which doesn't require a password. Single user mode lets you change the Unix root password.

Re: Lazy Linux: essential tricks for admins

#39
post #38
post #23

Earlier quoted context omitted.

Is the procedure for changing the root password with grub the same regardless of the flavour of Linux?

The primary bootloaders for Linux distributions are http://en.wikipedia.org/wiki/GNU_GRUB and http://en.wikipedia.org/wiki/LILO_(boot_loader) with a large edge in popularity to GRUB these days. Unless it's a fork or modification, GRUB works like this: http://www.gnu.org/software/grub/manual Single User Mode isn't unique to CentOS/Redhat, or even Linux. In fact, the concept behind it isn't even unique to Unix: One of…

I'm aware of GRUB and LILO. But as bootloaders, I didn't realize they were able to modify the Linux root password so easily. The question still stands: is it possible in any flavour of Linux to change the root password by modifying the kernel parameters at boot-time?
Post reply on HN