Download Linux Commands Cheat Sheet and more Cheat Sheet Web Design and Development in PDF only on Docsity! 1 ssh [ip or hostname] “vagrant ssh” in the same directory as the Vagrantfile to shell into the box/machine (assumes you have successfully “vagrant up”) Secure shell, an encrypted network protocol allowing for remote login and command execution On Windows: PuTTY and WinSCP An “ssh.exe” is also available via Cygwin as well as with a Git installation. pwd Print Working Directory Displays the full path name whoami Displays your logged in user id cd / cd target cd ~ Change directory to the root of the filesystem Change directory to “target” directory Change directory to your home directory ls ls -l ls -la Directory listing Long listing, displays file ownership Displays hidden files/directories Linux Commands Cheat Sheet Easy to use Linux shortcuts for developers. clear Clear the terminal screen 2 cat file.txt Displays the contents of file.txt to standard out cat /etc/system-release Displays the contents of the system-release file - what version of RHEL, Centos or Fedora are you running? cat longfile.txt | more Displays the contents of the file with forward paging less longfile.txt Scroll forward: Ctrl-f Scroll backward: Ctrl-b End of file: G Quit less: q man cat Man pages, the user manual. In this case, it will de- scribe the cat command 5 top What is eating your CPU which [executable] Where is the executable located 6 echo $PATH Displays the $PATH environment variable env Displays all ENV variables export PATH=$PATH:/anoth- erdir Adds “anotherdir” to your PATH, just for your current session sudo find . -name [file] Find a file or directory by name echo “Stuff” > target_file.txt echo “more” >> target_file.txt single > redirects the output to the file “target_file.txt” A double >> appends 7 grep -i stuff `find . -name \*.txt -print` Find the string “stuff” in all the .txt files head [file] Output the first part of file (first 10 lines) curl developers.redhat.com Retrieve the content from developers.redhat.com source myenvsetting_script.sh How to add something to the PATH and make it stick By default a new shell is launched to run a script, therefore env changes are not visible to your current shell. Note: the path uses “:” as a separator vs “;” in the Windows world sudo yum -y install net-tools “yum” is the installation tool for Fedora, Centos and RHEL. This command installs “net-tools” which has many handy utilities like netstat