Difference between revisions of "This Is Your Brain On Informatics: Linux"

From Pathology Education Instructional Resource
Jump to: navigation, search
Line 1: Line 1:
 
==Linux Tutorial from Class==
 
==Linux Tutorial from Class==
 +
 +
<p>Below are listed some common linux commands listed in alphabetical order that have been seen in class along with some others for reference. Syntax of the command is indicated by bracketed information. One common syntax includes [options], which indicates modifications to the command that can be added via a dash followed by an appropriate letter (e.g. -i for the rm command). </p>
  
 
{| class = "wikitable" style = "" cellpadding = "" border = "1"
 
{| class = "wikitable" style = "" cellpadding = "" border = "1"
Line 9: Line 11:
 
| cat [filename] || Display file’s contents to the standard output device (usually your monitor).
 
| cat [filename] || Display file’s contents to the standard output device (usually your monitor).
 
|-
 
|-
| cd /directorypath || Change to directory.
+
| cd [/directorypath] || Change to directory.
 
|-
 
|-
| chmod [options] mode filename || Change a file’s permissions.
+
| chmod [options] [mode] [filename] || Change a file’s permissions.
 
|-
 
|-
| chown [options] filename || Change who owns a file.
+
| chown [options] [filename] || Change who owns a file.
 
|-
 
|-
 
| clear || Clear a command line screen/window for a fresh start.
 
| clear || Clear a command line screen/window for a fresh start.
 
|-
 
|-
| cp [options] source destination || Copy files and directories.
+
| cp [options] [source] [destination] || Copy files and directories.
 
|-
 
|-
 
| date [options] || Display or set the system date and time.
 
| date [options] || Display or set the system date and time.
Line 27: Line 29:
 
| Exit || Leave an ssh session by typing
 
| Exit || Leave an ssh session by typing
 
|-
 
|-
| file [options] filename || Determine what type of data is within a file.
+
| file [options] [filename] || Determine what type of data is within a file.
 
|-
 
|-
 
| find [pathname] [expression] || Search for files matching a provided pattern.
 
| find [pathname] [expression] || Search for files matching a provided pattern.
 
|-
 
|-
| grep [options] pattern [filesname] || Search files or output for a particular pattern.
+
| grep [options] [pattern] [filesname] || Search files or output for a particular pattern.
 
|-
 
|-
 
| kill [options] pid || Stop a process. If the process refuses to stop, use kill -9 pid.
 
| kill [options] pid || Stop a process. If the process refuses to stop, use kill -9 pid.
Line 37: Line 39:
 
| less [options] [filename] || View the contents of a file one page at a time.
 
| less [options] [filename] || View the contents of a file one page at a time.
 
|-
 
|-
| ln [options] source [destination] || Create a shortcut.
+
| ln [options] [source] [destination] || Create a shortcut.
 
|-
 
|-
| locate filename || Search a copy of your filesystem for the specified filename.
+
| locate [filename] || Search a copy of your filesystem for the specified filename.
 
|-
 
|-
 
| lpr [options] || Send a print job.
 
| lpr [options] || Send a print job.
Line 47: Line 49:
 
| /man [command] || Display the help information for the specified command.
 
| /man [command] || Display the help information for the specified command.
 
|-
 
|-
| mkdir [options] directory || Create a new directory.
+
| mkdir [options] [directory] || Create a new directory.
 
|-
 
|-
| mv [options] source destination || Rename or move file(s) or directories.
+
| mv [options] [source] [destination] || Rename or move file(s) or directories.
 
|-
 
|-
 
| passwd [name [password]] || Change the password or allow (for the system administrator) to  
 
| passwd [name [password]] || Change the password or allow (for the system administrator) to  
Line 58: Line 60:
 
| pwd || Display the pathname for the current directory.
 
| pwd || Display the pathname for the current directory.
 
|-
 
|-
| rm [options] directory || Remove (delete) file(s) and/or directories.
+
| rm [options] [directory] || Remove (delete) file(s) and/or directories.
 
|-
 
|-
 
| rmdir [options] directory || Delete empty directories.
 
| rmdir [options] directory || Delete empty directories.
 
|-
 
|-
| ssh [options] user@machine || Remotely log in to another Linux machine, over the network.
+
| ssh [options] [user@machine] || Remotely log in to another Linux machine, over the network.
 
|-
 
|-
 
| su [options] [user [arguments]] || Switch to another user account.
 
| su [options] [user [arguments]] || Switch to another user account.
Line 68: Line 70:
 
| tail [options] [filename] || Display the last n lines of a file (the default is 10).
 
| tail [options] [filename] || Display the last n lines of a file (the default is 10).
 
|-
 
|-
| tar [options] filename || Store and extract files from a tarfile (.tar) or tarball  
+
| tar [options] [filename] || Store and extract files from a tarfile (.tar) or tarball  
 
(.tar.gz or .tgz).
 
(.tar.gz or .tgz).
 
|-
 
|-
 
| top || Displays the resources being used on your system. Press q to exit.
 
| top || Displays the resources being used on your system. Press q to exit.
 
|-
 
|-
| touch filename || Create an empty file with the specified name.
+
| touch [filename] || Create an empty file with the specified name.
 +
|-
 +
|wget [url] || Downloads a file from the internet at the specified url.
 
|-
 
|-
 
| who [options] || Display who is logged on.
 
| who [options] || Display who is logged on.
  
 
|}
 
|}

Revision as of 01:43, 23 October 2013

Linux Tutorial from Class

Below are listed some common linux commands listed in alphabetical order that have been seen in class along with some others for reference. Syntax of the command is indicated by bracketed information. One common syntax includes [options], which indicates modifications to the command that can be added via a dash followed by an appropriate letter (e.g. -i for the rm command).

Common Linux Commands
Command Name Command Description
cat [filename] Display file’s contents to the standard output device (usually your monitor).
cd [/directorypath] Change to directory.
chmod [options] [mode] [filename] Change a file’s permissions.
chown [options] [filename] Change who owns a file.
clear Clear a command line screen/window for a fresh start.
cp [options] [source] [destination] Copy files and directories.
date [options] Display or set the system date and time.
df [options] Display used and available disk space.
du [options] Show how much space each file takes up.
Exit Leave an ssh session by typing
file [options] [filename] Determine what type of data is within a file.
find [pathname] [expression] Search for files matching a provided pattern.
grep [options] [pattern] [filesname] Search files or output for a particular pattern.
kill [options] pid Stop a process. If the process refuses to stop, use kill -9 pid.
less [options] [filename] View the contents of a file one page at a time.
ln [options] [source] [destination] Create a shortcut.
locate [filename] Search a copy of your filesystem for the specified filename.
lpr [options] Send a print job.
ls [options] List directory contents.
/man [command] Display the help information for the specified command.
mkdir [options] [directory] Create a new directory.
mv [options] [source] [destination] Rename or move file(s) or directories.
passwd [name [password]] Change the password or allow (for the system administrator) to

change any password.

ps [options] Display a snapshot of the currently running processes.
pwd Display the pathname for the current directory.
rm [options] [directory] Remove (delete) file(s) and/or directories.
rmdir [options] directory Delete empty directories.
ssh [options] [user@machine] Remotely log in to another Linux machine, over the network.
su [options] [user [arguments]] Switch to another user account.
tail [options] [filename] Display the last n lines of a file (the default is 10).
tar [options] [filename] Store and extract files from a tarfile (.tar) or tarball

(.tar.gz or .tgz).

top Displays the resources being used on your system. Press q to exit.
touch [filename] Create an empty file with the specified name.
wget [url] Downloads a file from the internet at the specified url.
who [options] Display who is logged on.