TIP_some_bash_you_should_know_if_you_plan_on_acheiving_Linux_certifications
| Terminals / Shells • Network • X Window System • Portage • System • Filesystems • Kernel • Other |
Contents |
Intro
Here are some basic commands for the uninitiated. Since you've decided to jump way into the deep end with Gentoo, here's a little life preserver:
Uber Basic
| Name | Description |
| ls | list files (You can create useful aliases in your .bash_profile for things like l='ls -A', ll='ls -l', dir='ls -d'. I would also highly suggest the alias ls='ls --color=auto' for those terminals where color is an option.) |
| cp | copy files (the -r flag copies directories recursively; !!beware!! as cp overwrites any files you already have there -- use cp -i to interactively query whether you want to destroy any named files) |
| mv | move files (same thing as 'cp', except that you have the useful option '-p' to create a directory and all of its parent directories, should they not already exist) |
| rm | remove files (!!again, beware!!, use '-i' to make sure you don't remove something you want -- once it's gone, it's gone! |
| cat | print file to screen (perhaps somewhat less useful than 'less' for looking at a file, but it can be useful when piping between different commands like 'sort' or 'uniq') |
| find | find a file on the filesystem (read the manpage on how to use this utility - it ain't simple; instead, you might try to use a combination of 'locate XXX' piped into 'grep YYY' to find what you're looking for; 'find' is rather finicky) |
| lp | line print a file (this, of course, assumes you have cupsd or some other printing system running in the background) |
Lesser Known
- man - search for infomation about a given command run 'man man' to learn more
- apropos - given a description, find a command (searches manpages)
- whatis - given a command, find a description
- makewhatis - update the apropos / whatis db (must be run as root/sudo)
- locate - indexed searching, a thousand times faster than find (technically, this is slocate)
- updatedb - update the locate db (also must be rune as root/sudo)
- whereis - find a file in $PATH (the $PATH is where your current shell thinks all of the available executibles exist -- type 'echo $PATH' to see what it thinks)
- which - find the application that would execute if in several locations (find the FIRST location of the executible, as given in the $PATH variable. Thus, if you have a 'man' program in /usr/bin/ and a 'man' program in /usr/local/bin, and the $PATH lists /usr/bin before /usr/local/bin, it will only give the path to 'man' at /usr/bin)
- basename - given a full path, discover the basename of a file (often useful in shell scripts)
- head - print the first few lines of a file
- tail - the reverse of head -- see the last few lines (try 'tail -f XXX' to see all of the output appended to a file as it occurs)
- users - see who is logged on (and how many times)
- sort - sort a list, try `users | sort -u`
- uniq - read the man pages, but it basically outputs all unique (consecutive) occurrences of a line of text (generally speaking, this is more usefull when piped together with 'sort' first)
- whoami - in case you're feeling schizophrenic (or can't remember who you've 'su -'ed into at the time
- at - schedule a job to run at a particular time (also see 'cron' for regularly scheduled jobs)
- `showmounts -e` - show nfs mounts
- link - same as `ln -s`, to create symbolic links between files and directories (hard links can't be linked to directories or across file systems!)
- fc - find/run commands from command history -- be careful with this one (and the shell itself usually has better history control; be sure to look into the manual for bash [or my preference, zsh] for more details)
Links
A Very Consise Bash Quick Refrence (pdf)
Last modified: Sun, 06 Aug 2006 11:20:00 +1000 Hits: 3,390
Created by NickStallman.net, Luxury Homes Australia
Real estate agents should be using interactive floor plans and list their apartments, townhouses and units.
