Personal tools
You are here: Home PopNet Help: Using PRI's Networks Unix/Linux Handy unix commands

Handy unix commands

— filed under:

Useful commands to help you manage the linux command line.

Help

man

"man" is the command you issue to see the "man"ual for a given command.  Type man <command> to see how to properly use it and what options are available to help you make use of the given command.


File Commands

ls

List contents of current folder.

cd

Go from one directory to another.  Usage: cd <dir>

pwd

Find your current working folder.

mkdir

Create a new directory in the current folder.

rm

Delete a file or folder

.

cp

Copy a file or folder from one location to another.  Usage: cp <file1> <file2>

mv

Move a file or folder from one location to another.  Usage: mv <file1> <file2>

touch

Create a new empty file.  Usage: touch <file>

more

Output the contents of a file with page breaks.

tail

See the last few lines of a file.

 

Searching

grep

A useful command to help you search for a string or pattern within a file.

grep "example" results.txt

find

A powerful command to search for files and directories.

To find all ".doc" files:
find . -name '*.doc'

To find all files owned by user "jane":
find . -user jane

To find all files modified within the last 24 hours:
find . -mtime 1

Count the number of files

This counts all doc files in the current directory and its subfolders ...

find . -name '*.doc' | wc -l

Create a symbolic link

Create a symbolic link as a shortcut to a path specification using the syntax  
ln -s [TARGET DIRECTORY OR FILE] [SHORTCUT Name]

While in your home directory issue this command to allow you to go to /nfs/data/project/xn8thesis by clicking on the Thesis symbolic link in your home directory. :

ln -s /nfs/data/project/xn8thesis   Thesis
Related content
Document Actions

Copyright ©2014, The Pennsylvania State University | Privacy and Legal Statements
Contact the Help Site Administrator | Last modified Jan 28, 2013 | Weblion Partner