Linux Online Quick Guide
Prompt
The commands prompt is the first thing you see on a Linux system. It tells you which user you are logged in as, what server you are using, and where you are currently located in files or folders.
Commands
Useful list of basic commands. This is certainly not a full list of everything you can do.
Command | Name | Description |
---|---|---|
man <command> | Manual | Detailed guide for how to use any command |
pwd | Print Working Directory | Shows where you currently are located on the server. AKA "where am I?" |
cd <go/to/folder> | Change Directory | Change which directory you are currently in |
ls ls -l ls <directory> |
List Directory Content | List the files or folders in the current directory or a different one. Include "ls -l (Lowercase L ) for more details on the files |
mkdir <directoryname> | Make Directory | Make a new folder |
cp -r <copy/from> |
Copy | Copy a directory or file(s) from one location to another. The -r means recursive, which is required when copying folder |
touch <file> | Create Empty file | Creates an empty file with nothing in it |
history | Show the command history | Shows all the commands you previously typed |
module load <softwarename> | Load Environment | Gives you access to any pre-defined set of software on the cluster.(Ex Python, R, OneDrive) |
python scriptname.py | Run Python | Run a Python script. Make sure to run "module load python-libs" prior doing anything |
Terminal Tips
Extra functionalitites to be aware of when using a terminal session. Many will streamline usage.
- Up/Down Arrow Keys: see previous/next command you typed
- Left/Right Arrow Keys: move cursor left/right (mouse does not function in terminals)
- Tab: auto-complete the name of files/programs, double-tap tab shows matches for non-unique cases
Paths - Absolute vs. Relative
Knowing how to navigation a Linux-based file system is crucial, especially when it comes to identifying and using absolute vs. relative paths. Paths are used in a lot of commands.
Absolute | Relative |
---|---|
Starts with "/", which means "Beginning of server" | Does not start with a "/", which means "starting where I currently am". |
Examples: /data/groups /data/users/username/my_dir /data/users/username/my_file.py Absolute is exact and specific, which means it doesn't matter where you are when you run it. It always refers to the same file or directory. our can use "pwd" to get the absolute path of your current directory. |
See those periods? You can do "../../../" to go up 3 times |