Computer Services Logo We bring IT logo

Unix Commands

Note: You can use these commands at the Unix system prompt.
| more the pipe symbol (|), located above the backward slash (\) key, and the word more can be used after Unix listing commands (such as ls or cat filename) to display information one screen at a time (ls |more or cat filename |more). Press Enter or the Spacebar to scroll forward.
cat filename displays the contents of a  file
cat filename filename > new file copies one or more files to a newly created file
cat filename >> destination file adds one file to another file
cd moves back to your home directory
cd directory changes the current or working directory to another directory
cd .. moves back one directory
cp filename newfilename makes a copy of a file with a new name.  To copy the file to another directory, use the command:  cp filename directoryname or cp filename directoryname/newfilename
chmod changes the read, write, and execute permissions of specified files and the search permissions of specified directories.  For example, the command chmod 711 directorypath gives public access to that directory.  The command chmod 644 filename also gives public access to the listed file. You must be in the directory where the file is stored.
history | more displays of list of the last forty commands issued at the Unix prompt
kill -9 process# kills a process.  (Use ps command to list current processes.)
ls

lists directory contents and file information


ls -a lists all files including hidden files
ls -F lists files and subdirectories
ls -R lists the chain of directories starting from the current directory
ls -s lists the name and size of each file in a directory
man command displays information from the online Unix reference manual about a specific command.  For example, the command man cd displays information about changing directories.
man -k keyword displays the commands relevant to a keyword.  For example, the command man -k directory displays the commands for working with directories.
mkdir directoryname adds a new directory
more filename displays a file--one screen at a time
mv oldfilename newfilename changes the name of a file
mv "filenamewithspace" newfilename renames a file that has a space or unacceptable character in the filename.  For example, the command mv "new budget" newbudget changes the name of the file from new budget to newbudget.
mv filename directoryname/ moves a file to another directory.  Directoryname is the destination directory for the file.
nano filename
(Compute and HPC)
creates a file using the nano editor
pico filename
(Astro)
creates a file using the pico editor
ps lists the active processes running in your account.  (See the kill command to end a process.)
pwd displays the current working directory
rm filename deletes a file in a directory

rm filename1 filename2 deletes more than one file at a time
rmdir directoryname deletes an empty directory
rm -r directoryname deletes a directory and the subdirectories and files in the directory
vi filename creates a file using the vi editor

 

© . Temple University. All rights reserved.