Basic UNIX Commands
Some selected UNIX commands.
The command cd my_dir changes your position to the directory specified, in this case my_dir. The command cd without an argument moves you to your home directory.
The command cp first_file copy_file copies the contents of first_file into the file copy_file. To indicate that the new file is to have the same name as first_file, use a period (.) instead of of providing a name for the second file. (In this case, the files must be in separate directories, as two files cannot have the same name if they are in the same directory.) For example: cp some_directory/my_file . copies my_file, located in some_directory, and creates a file named my_file in the current working directory.
The command ls lists the files in the current directory. The form ls -F shows the difference between directories and ordinary files. The form ls -a lists all files, even those that are normally invisible in UNIX (files whose names start with a period, i.e. .xstartup).
The command mkdir new_dir creates a new subdirectory named new_dir in the current directory.
The command more my_file displays the text of my_file one page at a time. To see the next page, hit the space bar; to see the previous page, type b; to quit paging the file, type q.
The command mv file_name dir_name moves the file file_name from the current directory into the directory dir_name, where dir_name is a subdirectory of the current directory. The form mv old_file new_file renames old_file and calls it new_file.
The command pwd prints the pathname of the current, or working, directory.
The command rm my_file deletes my_file. The form rm -i my_file asks if you really want to remove the file my_file before it proceeds.
The command rmdir my_dir removes the directory my_dir. The directory must be empty before it can be deleted.