1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # File Commands pwd # Current working directory ls # List Files ls -a # List ALL files (show hidden) mkdir # Make a new directory rm # Remove file rm -r # Remove a directory (recursively) rm -rf # Remove a directory (no confirmation) cp # Copy a file mv # Rename/Move a file lm -s # Create a symbolic link touch # Create a new file wc # Bytes, words and lines in a file more. # Show contents of a file cat # Show contents of a file head # Show top 10 lines of a file head -n # Show top n lines of file tail # Show last 10 lines of a file tail -n # Show last n lines of a file tail -f # Show last 10 lines and continue to monitor |
1 2 3 4 5 6 7 8 9 | # File Permissions chmod 777 filename # Set rwx to owner group and everyone else chmod 755 filename # Set rwx to owner and r_x to everyone else chmod 766 filename # Set rwx to owner and rw to everyone else chown owner filename # Set file owner chown owner:group filename # Set file owner and group chown owner:group dir. # Set directory owner and group |
1 2 3 4 5 6 7 | # Directory commands cd dirname # Change into sud dir of current dir cd /app/data # Change to /app/data dir cd # Change to home directory cd ~ # Change to home directory cd .. # Change one dir level up |
1 2 3 4 5 6 7 8 9 10 11 12 13 | # Process commands ps # Display currently active processes ps aux | greb 'text' # Search for any processes with text in the name top # Display all running processes ( Ctrl-C to exit ) kill pid # Kill process with pid killall proc # Kill all processes name 'proc' pkill proc # Send signal process called 'proc' Ctrl-Z # Send app to background app & # Run all in background shell bg # List all processes in background fg name # Bring to for ground process 'name' pgrep name # Get the process id of app 'name' |
1 2 3 4 5 6 7 8 9 10 | # Shell commands Ctrl-a # Beginning of line Ctrl-e # End of line Ctrl-d # Delete current line Alt-f # Forward one word Alt-b # Back one word Ctrl-k # Erase to end of line Ctrl-u # Erase line Ctrl-r # Search command history |