Unix - basic skills
Remember that the working directory in the UNIX window can be
completely different from what you see in the file manager.
Normally you start in your home directory when you open your
UNIX window or your file manager, then you can change
directory in both or just one of them.
If you are unsure where in the filetree you are, use following command in your UNIX window:
Remember that UNIX is case sensitive, that 'Myfile' is not the same as 'myfile'.
Each command is written at a single row, with space between each argument, in the terminal window.
The commands are executed with the | button. |
Basic commands
cd directory | Change directory; Change working directory to directory. |
cd .. | Change the working directory one step up in the file structure. E.g. from '/edu/yourdirectory/div' to '/edu/yourdirectory' |
pwd | Present working directory; Shows your current location in the filetree. |
ls | Lists all files and directories in current working directory. |
ls -l | List -long; Lists all files and directories, each on a new row. Gives you information about the current state of protection (the rights to read, write and execute) and creation date of the files and directories. |
cp fromfile tofile | Copy; Copies the file fromfile and names the copy tofile. |
cp ~aaabb123/testfile . | Copy; Copies the file testfile located in the home directory of user 'aaabb123' to current working directory, this is the function of the dot at the end. |
Up arrow | This button shows you the last command given to the computer. It can be pressed several times to go further back in the command list. |
Down arrow | Vice versa. |
mkdir directory | Make directory; Creates a new directory, in current directory, named directory. |
mvdir fromdirectory todirectory | Move directory; Moves (or renames) a directory. |
mv fromfile tofile | Move; Moves (or renames) a file, or a directory, and all files in that directory. |
rm file | Remove; Removes a file. Warning! A very powerful command! |
rmdir directory | Remove directory; Removes a directory (the directory must be empty). |
chmod a=rwx file | Change mode; Removes all protection from the file and gives you and all persons the right to read, write on and execute 'file'. |
lp [-Pprinter] file | Prints file. If the argument '-P' and the name of a specified printer is given, the file is directed to the specified printer |
lpq [-Pprinter] | Shows current printer queue and the number of the jobs. With the argument '-P' it shows the printqueue of printer. |
lprm [-Pprinter] | Removes all jobs in the printer queue. |
lprm [-Pprinter] jobnumber | Removes a specified job. |
passwd | Password; Changes your password. |
man command | Manual; A help function which shows you the manual pages about command. - Very useful! |
Interupts current program |
Informationsansvarig: Kristina Arkad
Senast uppdaterad: 2015-05-25