Basic Commands
When you open a terminal window in linux you will automatically be in your home directory. To print your current directory
pwd
>/home/des
To go up one directory
cd ..
>/home
To go back home from whatever directory you are type cd
cd
List directory
ls
Long listing of directory
ls -l
Long listing including hidden files
ls -la
Long list directories only
ls -ld
Switch user
su
Add a user called des with a home folder /home/des
useradd -m -d /home/des des
Apply or change the password for a user account
passwd des
List users who are logged in to your machine
who
Check the id number of a user
id des
To count the number of files in freds home directory we can pipe ( | ) the results of ls -l into a wc -l command which counts the number of lines
ls -l /home/fred | wc -l
You could also use wc -l to count the number of lines ina text file
cat mytextfile | wc -l