Unix Commands: Navneet Sharma
Unix Commands: Navneet Sharma
COMMANDS
NAVNEET SHARMA
ABOUT UNIX
Made up of three parts; the kernel, the shell and the programs.
UNIX TREE
BASIC COMMANDS
When you first login, your current working directory is your home
directory. Your home directory has the same name as your username, for example, nsharma03, and it is where your personal files
and subdirectories are saved.
ls (list)
ls a (for hidden files and directories)
ls ltr (for detailed list in sorted fashion)
mkdir (make directory)
check with ls what got created
touch (create a file)
touch <filename>
rm
rm r for a recursive deletes, used for directories
BASIC COMMANDS
cp (copy)
cp file1 file2
mv (move)
or rename (if moved with a different name in same directory)
cd (change directory)
cd (will take to home directory)
cd will take to previous directory
BASIC COMMANDS
clear(clear screen)
cat(concatenate)
display the contents of a file on the screen.
cat test.txt
less
writes the contents of a file onto the screen a page at a time
less test.txt
head
writes the first ten lines of a file to the screen.
head test.txt
head -5 test.txt
BASIC COMMANDS
tail
writes the last ten lines of a file to the screen
tail test.txt
tail -100 test.txt
grep
searches files for specified words or patterns
grep science test.txt
grep -i science test.txt
grep -i science test test.txt
wc (word count)
wc l test.txt wc w test.txt
BASIC COMMANDS
redirection
grep find test.txt > find.txt
pipes
wc l test.txt | head -10
vi .bashrc