Use GNU/Linux
From CS113
Like most operating systems, data is organized into files and directories.
Create a directory with mkdir dirname
. Delete a directory with rmdir dirname
.
List the contents of the current directory with ls
. Use ls -al
to see extra information.
To see the contents of a file without editing it use cat filename
.
To remove a file, use rm filename
.
WARNING: Removed files cannot be recovered. There is no confirmation before the file is removed. There is no recycle-bin. Use rm
with extreme caution. Otherwise, always use rm -i filename
so it asks for confirmation.
To move or rename a file, mv oldname newname
WARNING: If a file with newname
already exists, it will be replaced without confirmation. mv -i oldname newname
will ask for confirmation before clobbering any existing files.
To mail a file to yourself, use mail netid@cornell.edu < filename
To kill a program that is misbehaving (infinite loop), use killall progname
where progname
is the name of the program you want to kill (e.g fact
if you compiled and are running ./fact
)
Most commands can be interrupted with <ctrl>-c
. For example, if you type cat
at the shell without giving it a filename (or bc
, dd
, etc.), you can close the command and return to the shell by pressing <ctrl>-c
.
You can create aliases (command shortcuts) using alias shortcut='full command'
. For example, alias mv='mv -i'
will automatically substitute mv -i
whenever you try to execute mv
.
You can autoexecute commands to be run upon login by adding them to the file .bashrc
in your home directory. Use VIM to edit the file: vim ~/.bashrc
. (The ~ character is a shortcut for your home directory)
See Linux Shell Tutorial for more commands.