Basic Unix/Linux Commands for Bioinformatics


UNIX/LINUX Terminal
Unix/Linux OS has a terminal. A "terminal" is a way of typing commands to the computer.You can either open a terminal inside your graphical environment, or you can switch your whole screen to a terminal

To open a terminal in a graphical enivronment
1. Open up your menu. This is either the "red hat" or "F in a bubble" icon in the tray (at the top or bottom of the screen). (It might also be a little "foot," or possibly a little penguin.)
2. Under System Tools, click on Terminal. (In some versions of Fedora, it's under Accessories instead of System Tools.)

To switch your entire screen to a terminal, press Ctrl-Alt-F1. You can then switch between six different terminals, by using Alt-F1 through Alt-F6. Pressing Alt-F7 will bring you back to your graphical environment.

After opening terminal, we can type these commands

LINUX/UNIX COMMANDS
ls (list). Does a directory listing.
ls lists a directory in columns
ls -l gives a fuller listing including file permissions, size, date created
ls -al similar to the above but includes "dot" files

cd (change directory).
cd return to the home directory
cd .. move up one directory level
cd ../.. move up two directory levels
cd subdirectory move to subdirectory

cp (copy).
cp file1 file2 copy file1 to file2
cp file1 subdirectory copy file1 to subdirectory
cp file1 file2 directory copy file1 and file2 to directory

mv (move). Moves or renames one or more files.
mv file1 newname renames file1
mv directory newname renames directory
mv directory existing-directory moves directory to a subdirectory of target
mv file1 file2 directory move files to directory

mkdir (make directory).
mkdir subdirectory creates a subdirectory in the current directory

more. Lists files one screen at a time. Pressing the space bar dislays the
next screenful and pressing q or ctrl-c cancels the listing.
more filename

cat (catenate). Display, combine or append files.
cat file1 display file1
cat file1 file2 > file1and2 combines file1 and file2
cat file1 >> file2 append file1 to file2

chmod (change mode). Change file permissions.
chmod u+w file1 add write permission for the user to file1
chmod g+x file1 add execute permission for the group to file1
chmod o-r file1 remove read permission for the world from file1

man (manual). Display reference manual documentation for the specified command.
man chmod display manual information for the chmod command
man -K keyword shows all of the man pages that contain keyword

pwd (print working directory). The default setup on nun is to have the
system prompt display the current directory. This means that there isn't
much need to use the pwd command.

rm (remove). Deletes files. Never use rm * (it will delete all of your
files). rm filename will remove the specified file. There is no
undelete. Some files may be recoverable from backups.
rm filename deletes the file with the specified filename
rm -i filename deletes the file after prompting

rmdir (remove directory). Deletes empty directories.

passwd (password). Changes your password. We recommend password of two
three letter words connected with a punctuation symbol or a number.
passwd newpassword changes your password

exit Terminates a session.

Labels: