Loading the lesson...
In the print dialog, choose "Save as PDF" as the destination.
Operating Systems 1 - Week 02 Lab
Talking to the operating system directly: how a command is shaped, where you are in the filesystem, and how to create, copy, move and remove things safely.
~ is shorthand for the current user's home directory;man command_name opens a command's full manual pageman -k searches by keyword, and man -f searches by exact namecommand_name --help prints a quick usage summary instead| Part | What it is |
|---|---|
| command | the program or action to run |
| options | flags, usually starting with - or --, that modify behavior |
| arguments | the files, directories or values the command acts on |
pwd prints the absolute path of your current location in the filesystem| Form | Where it takes you |
|---|---|
cd /path/to/directory | a specific absolute path |
cd .. | up one directory level |
cd ~ or plain cd | the home directory |
cd - | back to the previous directory |
ls [directory_name]-a shows all files, including hidden ones-l shows long format with detailed information-lh shows long format with human-readable file sizes-d shows information about the directory itself, not its contents-F appends indicator characters to special filestouch file1
mkdir folder_name
mkdir -p new_folder/folder1-p flag creates every missing parent directory in one shot.cp source target copies a file, leaving the original untouched-i enables interactive mode, prompting before overwriting-r performs a recursive copy, required for directories with contentsmv source target moves or renames, and the shell treats both as the same operationmv -i prompts before overwriting an existing targetrm file_name deletes a file, and rm -r also removes a directory and its contentsrmdir directory_name removes a directory only if it is already emptyman to explore the full set of options for any command-i when copying or moving, to avoid accidental overwritesTab key for filename and command auto-completionpwd, cd and ls answer where you are, move you, and show you what is theretouch and mkdir create, and mkdir -p builds a whole path at oncecp needs -r for directories, and -i is the habit that prevents silent overwritesmv renames and moves with one command, and rmdir only ever removes an empty directoryman and --help are the two places to look before guessing at a flagMahmoud Abas|Operating System (1) - Week 02 Lab