Linux Notes
Linux
At work, I deal with a few Windows and Solaris machines, but the majority of the servers and workstations I work with are running GNU/Linux. We use RedHat, and now Fedora, on our machines with very good results. Occasionally I find myself helping with problems on other distributions such as Debian, Gentoo and Mandrake, but since I mostly deal with RedHat/Fedora, any configurations files, etc. listed here will be based on a RedHat setup - your milage may vary.
Shell Tips and Shortcuts
- Command Substitution - Say you mistyped
your last command, or you want to use all the arguments
from your last command in a new command - the easiest way
to do this is using the substitution command that is built
into many shells. To do this, use the '^' (carrot).
ie.
$ ping hostname.com
$ ^ping^ssh
Note, the first command will ping the host, the second command
replaces 'ping' from the previous command with 'ssh', so
you ssh to the host.
- Command Aliases - If you are like me,
then you want to type as little as possible. This can be
done using aliases. For example, you can alias 'm' to stand
for 'more', so the command 'm filename' will run 'more'
on that file. You can set aliases in your login scripts
(like ~/.bashrc) by simply adding a line like the following
alias m='more'
- Useful Shortcuts - Here are a few things I use all the time.
I wish I'd learned them sooner, since they are great time savers.
- ctrl+L - Same as the 'clear' command, it clears your terminal screen.
- cd - when typed without any arguments, it takes you to your home directory
- rpm -qf /path/to/file - Tells you
which RPM provides the specified file. This is short
for 'rpm --query --whatprovides'
Fun Commands
- Inode Usage - When using ext3 (among other filesystem types),
the disk is formatted with a preset maximum number of inodes (file handles).
To check on the usage of the inodes, you can use the command df -i.
This is similar to the 'df' command to show disk usage, but it shows you the inodes
instead of the space usage. Adding a -h flag will display it in human readable form.