banner

Home Forum Wiki hp links photos

 
Translations of this page?:

Basic Terminal Usage

At first the command line might seem daunting but you can use these quick tips to speed things up a little. You'll soon be able to navigate the terminal like a pro.

Terminal Fundamentals

To open a terminal, press ctrl+alt+t

Tab completion: If you type the first few characters of the thing you want and then press your tab key, the terminal will show a list of all possible completions which begin with those characters. If you hit tab while on the first word of a command, it will show possible commands; otherwise, it will show files and directories.

Useful Commands

Things within angle brackets should be replaced with the file or directory you're working with; the angle brackets themselves shouldn't actually be typed.

Command Command name Usage
ls List Shows the contents of the current directory
ls <directory> Shows the contents of <directory> (this applies to the other uses of ls, too)
ls -a List all files in the current directory, even hidden ones
ls -l List all files along with their size, owner, and other information
ls -lh Same as above, but lists sizes in “human-readable” format (184M instead of 191901696)
cd <directory> Change directory Switch to the directory specified
cd ../ Go up one directory (this works more than once; cd ../../ goes up two directories, etc.)
cp <source> <dest> Copy Copy file or directory from <source> to <dest>. This will not warn you about overwriting files, see cp -i
cp -i <source> <dest> As cp, but will ask you before overwritting files; you should this instead of cp
mv <source> <dest> Move Move file or directory from <source> to <dest>. Also used to rename files: you move the file from the old name to the new one. This will not warn you about overwriting files, see mv -i
mv -i <source> <dest> As mv, but will ask you before overwritting files; you should this instead of mv
rm <file> Remove Removes (in other words, deletes) <file>. Since this will definitely wipe out files, use the version below
rm -i <file> As rm, but asks for confirmation
rm -r <directory> Removes <directory> and everything contained therein, including other directories. Use wisely.
mkdir <directory> Make directory Creates a new directory called <directory>
mkdir -p <path/directory> Used to, e.g., create some/new/directory even if the some/ and some/new/ directories don't already exist; it will create any new directories as necessary
ps -Af Processes See all running processes and which user is running them
lp <path to file> Print Print file on default printer

Because of the potential risk of overwriting files with cp, mv, and rm, many experienced users recommend changing the actions of these commands using the alias command; see the Intermediate page for details.

Console Copy and Paste

To copy text from the terminal just highlight the text that you want to copy; you don't need to press any special keys. To paste, click on the terminal window and use shift+ins or press both mouse keys at the same time (middle mouse key) and the highlighted text should appear in the terminal.

If you want to use traditional copy and paste (aka gui paste) you should use konsole instead; simply type konsole in the terminal to start a console with paste support.

Additional Information

For further useful commands and a discussion of the Linux directory structure, please read Intermediate Terminal Usage.

 
howto/basicterminalusage.txt · Last modified: 2008/04/18 13:31 by lee
 


Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki