Beginners Guide To Using Linux


Welcome to Introduction to Linux guide, lets move forward by showing you a few useful Linux commands. We have color coded this chart to make things even easier. Commands are green, variables such as command options, flags and user defined files or directories are orange and you will most likely substitute these with your own.

Getting Help

Command Description
man command Often referred to as the 'man page', most commands have a users manual. These manuals list available options, proper usage and general information. We strongly suggest you utilize man and learn more about the command before using it.

Navigation & Directories

Command Description
ls Lists the contents of the directory.
pwd Display the name of the directory you're currently in.
cd .. Changes your directory down one level.
cd dir Changes to the directory named 'dir'.
cd / Changes to the root directory. You may also states directories explicitly. Eg: cd /home/user
cd ~ Changes to your home directory.
cd ~- Changes to the last directory you were in.

File Management

Command Description
cp file1 file2 Copies the file named 'file1' to another file called 'file2'. Leaving the original 'file1' intact.
mv file1 file2 Moves (renames) the file 'file1' to 'file2'.
mkdir dir Creates a directory named 'dir'.
rm file Removes the file 'file'.
rm -f dir Removes the directory 'dir' and anything in it.
rmdir foo Removes the directory 'foo'. This only works if the directory is empty.
cat somefile Scroll the contents of the file 'somefile' on your terminal all at once.
cat somefile Displays the contents of 'somefile' on your screen, and lets you scroll through it slowly.
tail somefile Displays the last 10 lines of somefile.

Processes and Programs

Command Description
ps -aux Shows every process that is running on your system and associated process ID.
kill -9 1234 Stops the program process ID '1234' (from ps aux).

Searching

Command Description
whereis something Searches common locations for the program 'something'.
whatis something Use this command if you are unsure what a program does, it should spit out a short synopsis.
grep -R something . Searches for the word 'something' in your current directory.
find / -name something Searches the / dir for 'something'.

The System

Command Description
date Display the current date and time. To adjust system date use: date -s "Thurs Aug 27 14:38:00 EST 2000"
hostname Display the system hostname.
uptime Gives a one line display of time, how long the system has been running, users logged in and load averages.
top A listing of running processes sorted by CPU usage in real time.
free -m Information on system memory (in megabytes).
df -h Display information on disks and file systems (in human-readable format).
cat /proc/version Display information on your version of Linux.
cat /proc/cpuinfo Display CPU information on the system.
cat /proc/filesystems Display information on the file system types in use.
uname -a Display information on the kernel version.
shutdown -h now Halts (-h) the system, shutting it down soon as you press enter. You can also specify a time, i.e shutdown -h +15, this means the system will halt in 15 mins.
shutdown -r now Reboots (-r) the system, rebooting it soon as you press enter. You can also specify a time, i.e shutdown -r +15, this means the system will reboot in 15 minutes.

Users and Groups

Command Description
whoami Displays who you are logged in as.
who Display a list of users currently logged into the system.
last -10 Display a list of the last 10 users logged into the sytem, alternatively you can specify a username.
useradd To add a new user on your system. See man page for options.
usermod Used to modify a user account. See man page for options.
passwd Allows you to change an already existing user account password.
userdel -r username To remove a user from your system, along with all files owed by the user.
su - Become superuser (root). Note: Some version of Linux use sudo.