Working With the Command-Line Interface
- Understanding the CLI
- All operating systems offer a command line interface (CLI).
- A specific CLI is called a ‘shell’; most OSes provide multipole shell choices.
- All shells have a prompt to type in commands.
- Many commands use switches ( -n, -a, etc.)
- All shells offer some form of help. (Type <help> or /?)
- Navigating the CLI: Windows/Linux
- Use the ‘cd’ command in all OSes to move the prompt to different folders/directories.
- Make sure you can use the ‘cd’ command in Windows, Mac and Linux environments to navigate a system. (Mac & Linux are based on Unix.)
- To change drives in Windows, type the drive letter at a prompt and press the Enter key.
- Navigating the CLI: Working with Folders
- Use the ‘md’ or ‘mkdir’ command to make a folder or directory.
- Windows is case insensitive; Linux is case sensitive.
- Use the ‘rd’ or ‘rmdir’ command to delete or remove a folder or directory.
- Use ‘rd /s’ in Windows or ‘rm -r’ in Linux to remove a directory and its contents.
- Working with Files
- Use the ‘del’ command to delete files
- Use wildcards (*) to work with multiple files at a time.
- Use the ‘copy’ command to copy files.
- ‘Move’ is identical to ‘copy’ but deletes the original.
- Know the ‘delete’, ‘copy’, & ‘move’ commands for Linux.
- Working with Drives, Part 1
- The ‘format’ command formats partitions & uses many switches to control the type of format.
- ‘chkdsk’ fixes formatted partitions.
- ‘sfc’ repairs critical Windows files based on the system store.
- ‘dism’ repairs critical Windows files based on online system stores.
- ‘diskpart’ partitions drives.
- Super Copy Commands
- The ‘copy’ command is is inconvenient for copying directory trees.
- ‘xcopy’ is the original Windows tool to copy entire directory trees, including any files in the tree.
- ‘robocopy’ is an improved version of ‘xcopy’, it’s faster and safer.
- Linux uses the ‘dd’ command.
- Advanced Windows Command Line
- The ‘shutdown’ command shuts down the system.
- ‘tasklist’ & ‘taskkill’ lists & shuts down processes on a system.
- ‘gpupdate’ or ‘gpresult’ forces policy updates to a system and lists the resultant policy.
- Advanced Linux Commands, Part 1
- ‘shutdown’ shuts down the system
- ‘apt-get’ gives users access to the Debian repository.
- The ‘ps’ command gives control over processes.
- ‘kill’ shuts down processes.
- ‘Vi’ is an ancient text editor.
- Command-Line Permissions
- ‘icacls’ enables changing NTFS permissions from the command line
- ‘chmod’ enables changing Linux permissions
- ‘chmod’ changes file permissions in a Linux environment.
- These tools require the user to understand how permissions work, with the Windows & Linux platforms.
- ‘chown’ enables root users to take control of any Linux folder or file.
- ‘chown’ changes ownership
- ‘passwd’ changes password
- Introduction to Scripting
- A batch file is a text file that stores a list of commands.
- Batch files use a “.bat” file extension.
- Environment variables are phrases that point to system-wide functions.
- PowerShell provides far more powerful scripts.
- Linux bash shell scripts also provide powerful scripting functions.
- Interpreted Languages
- Operating systems have built-in interpreters.
- Visual Basic uses files with the “.vbs” extension.
- Python files use the extension “.py”.
- Javascript (“.js” extension) is popular for web applications