Unix Tools
unix tutorials, unix security, unix help

 

Unix Tutorial

Getting Started with Unix

Getting started in unix is easy. Here are some simple steps to working on a UNIX box.

Logging in

Logging in: To log in you have 2 prompts. Both fields are case sensitive. The first prompt will be your username; the second prompt will be your password. If you remember that this is case sensitive, you are easily on a unix system.

Directory Commands:

Tell you what directory you are in: pwd
To find out what directory you are in, use pwd, which stands for print working directory.

  • Changing directories: cd directory
    To change your directory simply use cd directory-name. In UNIX, if you are using a full path use the forward slash. For example, a user named "joe" may have his home directory in /home/joe. Joe can get to his default home directory by simply typing cd. If he wants to be in /tmp, he would type cd /tmp
  • Making directories: mkdir directory
    Use the mkdir command to make one or more directories.
  • Removing directories: rmdir directory
    Use the rmdir command to remove one or more directories.

File Commands:

  • Listing files: ls
    To list files you use the ls command. This simply lists the files in a directory. There are many variations of this command. That is, you can add options to see hidden files, time stamps of files, and permissions. If you ls filename, you will see is filename exists. If filename is actually a directory, you will be able to see see the contents of that directory.

    Often the first thing one does is do a ls when they log into a system. This allows them to see what files they are using and are working on.

  • Moving files: mv
    You move files with the mv command. Simply mv file newfilename. You can move a file to another filename or into a directory.
  • Copying files: cp
    You copy files with the cp command. Simply cp file newfilename. You can copy a file to another filename or into a directory.
  • Removing files: rm
    You remove files with the rm command. Simply rm file newfilename. You can remove many files at once. Unlike windows, you can NOT back out of a remove. Be certain that you want to remove a file.
  • Editting files: vi or emacs or pico
    As each editor of files is vastly different, you will want to learn these separately. Usually, new users will find pico easiest to learn. However, not all unix systems have pico. Hence, you may need to learn vi

Getting Help:

  • Getting help: man -k topic
    The man command helps you get manual information. Run man -k topic to find the man page you need. Then run man commandname to get help with the actual command.

 

Quick Reference

Which directory am I in?

pwd

Change Directories

cd desired-directory

Make Directories

mkdir desired-directory

Remove Directories

rm desired-directory

List Files

ls

Copy Files

cp file1 file2

Move Files

mv file1 file2

Remove Files

rm file

Help

man