/ Programming

*NIX Command Examples

This is going to be a place where I put in some important UNIX commands that I find useful, hopefully you will too!


This stands for the home directory of the current user (points to $HOME). If your home directory was located at /Users/willkara than ~ would stand for that.


This is the Unix directory seperator. When a file path starts with /, then it starts with the root directory. /Users/willkara/Documents/NetBeansProjects would mean that it is located in the User subdirectory that is within the root directory of the system. When at the end of a file path /Users/willkara/Documents/ it means to explicitly say that this is a directory.


This will change your current directory to the one specified. Uses absolute paths.

Example: If I want to get to the directory Dropbox, located in my home directory, I would use 'cd ~/Dropbox'.


This will list all of the current files and directories in the directory you are currently in. This command has MANY options and I'll write out examples over time

  • ls - Lists the items by name in alphabetical order.
  • ls -ltr - Lists the items in chronological order while displaying unix properties for the listed files/directories.
  • ls -l | grep [KEYWORD] - Pipes the results of the ls -l command to grep and searches for your keyword. The results of this command will be the files/directories where their name includes your keyword. I like this one.


There is no such thing as a valid tar command, move along.


This is called a pipe. It 'pipes' the output of one process as the input of another. It is used in the ls -l | grep command above. This sends the results of ls -l to the grep command as input.


Returns information regarding the current running processes. I usually use this with the options of -ef, which gives me a list of the running processes with more information.

  • ps -ef- Gives you a list of the current running processes on the system.
  • ps -ef | grep ####- Search the current running processes for a keyword. Example- ps -ef | grep java, would list all of the current processes running/dealing with java.


A system monitor for *NIX systems. It will show you currently running processes that can be grouped by CPU usage, memory usage and more. Can be very useful as a complete system monitor to track usages. Think of it as a prettier top with more functionality.`

*NIX Command Examples
Share this

Subscribe to Wills Thoughts