Get your sha1 signature/hash of a file with shasum
:
$ shasum ./somefile.ext
You can find documents/files/stuff using the find
command:
$ find . -name "*.txt"
Find out which ports are being used by system processes using netstat
:
$ netstat -an | grep 8080
You can get a bit more information with lsof
(list open files):
lsof -i :8080 | grep LISTEN
You can stack commands (like ps
and grep
) as in this case:
$ ps aux | grep tomcat
Here, ps
(process snapshot) is displaying processes using the following parameters…
a
= show processes for all users
u
= display the process’s user/owner
x
= also show processes not attached to a terminal
… that is “piped” (using the “|” operator) to a which filters the results to give you only those that have "tomcat"
within them.
Similarly, you can route output from a command into a file, rather than displaying it in the terminal. Consider this example: cat
(concatenate) with
$ cat *.txt > gratuitously-concatenated-file.txt
This will put the contents all of the matching text files (any with the .txt file extension in the same current directory) into a file called gratuitously-concatenated-file.txt
. But if you are working in the same directory, don’t call the file by the same name as what you are concatenating (when using so greedy a wildcard), because it will recursively add itself to itself until the disk is consumed.
source
will reload the contents of your bash profile. One use case for this is not having to start a new session just to realize changes made to a particular path variable.
$ source ~/.bash_profile
OR
$ . ~/.bash_profile