Linux/Mac Commands

Navigating the file system:

				
					pwd: Prints the current working directory.

				
			
				
					cd: Changes the current directory.
				
			
				
					ls: Lists the files and directories in the current directory.
				
			
				
					ls -la: List the files and directories with more detail. You will be able to tell if an item is a file or a directory.
				
			

Creating and managing files and directories:

				
					mkdir: Creates a new directory.
				
			
				
					
touch: Creates a new file.
				
			
				
					mv: Moves or renames a file or directory.
				
			
				
					cp: Copies a file.
				
			
				
					cp -r: Copies a directory. (recursive)
				
			
				
					rm: Deletes a file.
				
			
				
					rm -r: Deletes a directory.
				
			

Viewing and editing files:

				
					less: Allows you to view the contents of a file one page at a time.
				
			
				
					nano: A simple text editor to edit the file in terminal
				
			
				
					vi/vim: A more advanced text editor to edit the files in terminal
				
			
				
					cat: Displays the contents of a file.
				
			
				
					vi/vim: A more advanced text editor to edit the files in terminal. Does not come by default. Needs to be installed.
				
			

Searching and filtering:

				
					grep: Searches for a specific string in a file or multiple files.
				
			
				
					find: Search for files in a directory hierarchy.
				
			

Permissions and ownership:

				
					chmod: Changes the permissions of a file or directory.
				
			
				
					chown: Changes the ownership of a file or directory.
				
			

Miscellaneous:

				
					clear: Clears the terminal screen.
				
			
				
					exit: Closes the terminal window.
				
			
				
					man: Displays the manual pages for a command.
				
			

Windows Commands

Navigating the file system:

				
					dir: Lists the files and directories in the current directory. Example: dir or dir /w to see the files in a detailed format.

				
			
				
					cd: Changes the current directory. Example: cd Documents to move to the Documents directory
				
			
				
					
popd: Changes the current directory back to the previously stored directory. Example: popd to move back to the previous directory.
				
			
				
					
chdir or pushd: Changes the current directory and stores the previous directory. Example: chdir Documents or pushd Documents to move to the Documents directory.
				
			
				
					tree: Lists the files and directories in a hierarchical format. Example: tree or tree /f to see the files in a detailed format.

				
			

Creating and managing files and directories:

				
					md or mkdir: Creates a new directory. Example: md new_folder or mkdir new_folder to create a new folder with the name 'new_folder'.
				
			
				
					copy: Copies a file or directory. Example: copy file1.txt file2.txt to copy file1.txt to file2.txt or xcopy foldername newfoldername /s to copy the whole folder with its contents to a new folder
				
			
				
					move or ren: Moves or renames a file or directory. Example: move file1.txt file2.txt or ren file1.txt file2.txt to rename file1.txt to file2.txt or move foldername newfoldername or ren foldername newfoldername to rename the folder.
				
			
				
					del or erase: Deletes a file or directory. Example: del file1.txt or erase file1.txt to delete file1.txt or rd foldername or rd /s foldername to delete the folder and its contents.
				
			

Viewing and editing files:

				
					type: Displays the contents of a file. Example: type file1.txt to see the contents of file1.txt
				
			
				
					more: Allows you to view the contents of a file one page at a time. Example: more file1.txt to view the contents of file1.txt
				
			
				
					notepad: A simple text editor to edit the file in command line. Example: notepad file1.txt to open and edit file1.txt in notepad
				
			
				
					edit: A simple text editor in command line, that works only in command prompt. Example: edit file1.txt to open and edit file1.txt in edit
				
			

Searching and filtering:

				
					find or findstr: Search for a specific string in a file or multiple files. Example: find "search_string" file1.txt or findstr /s /c:"search_string" file1.txt to search for "search_string" in file1.txt
				
			
				
					forfiles: Select a file or a set of files and then execute a command on those files. Example: forfiles /p "C:\Windows" /s /c "cmd /c echo @file" to search for files in the directory "C:\Windows" and print their names

				
			
				
					notepad: A simple text editor to edit the file in command line. Example: notepad file1.txt to open and edit file1.txt in notepad
				
			
				
					edit: A simple text editor in command line, that works only in command prompt. Example: edit file1.txt to open and edit file1.txt in edit
				
			

Permissions and ownership:

				
					cacls: Displays or modifies access control lists (ACLs) of files. Example: cacls file1.txt to view the permissions of file1.txt or cacls file1.txt /g user1:F to give