Linux Command-Line Tips
A short Linux shell reference for locating commands, reloading Bash configuration, and writing here-documents.
Learning about a command
Using ping as an example:
which pingwhatis pingwhereis pingman pingtype pingtype ping displays:
ping is /sbin/ping
type source displays:
source is a shell builtin
Reloading a Bash profile
Reload a profile file without signing out and back into the terminal:
source /etc/profileThe source command runs a file’s contents as input to the current shell. A single dot, ., is an equivalent command.
For example, after moving phantomjs into /usr/local/bin, pressing Tab may still fail to complete the command. Completion becomes available after running source.
cat <<EOF versus cat <<-EOF
A common use is to write input to a file, as in this Scrapy example:
cat > myspider.py <<EOFThis is a convenient way to add lines to a new file. Both forms read standard input until the EOF marker. The -EOF form strips leading tabs from each line—tabs only, not spaces.
The original image has been removed from the source site: original image URL