This is a quick and very basic crash course for someone new to linux administrator. The following commands should get you through navigating files and simply finding your way around the operating system.

 
Help!
One option that might be useful if your stuck is to follow a command with –help. This will display the help page for that command, if you have the correct command.

It’ll show you any requirements when running that command, or show you extra options.

cd     --help
mv     --help
rm     --help
sudo   --help

 

Change Directory

cd /var/   # navigate directory to /var/
cd /       # navigate to root of system
cd ../     # navigate up a directory
cd ../../  # navigate up 2 directories

 

List Directory

ls         # list directory
ls -l      # list in long format
ls -a      # list all
ls -la     # list all in long format

This page has a full list of options.

 

Move, Copy or Rename a file

mv originalfile newfile              # rename a file
mv /var/origfile /home/originalfile  # move a file
mv /var/origfile /home/newfile       # move file and rename

cp originalfile newfile              # copy a file
cp /var/origfile /home/originalfile  # copy a file to another dir
cp /var/origfile /home/newfile       # copy file and rename

For the above, and some instructions below, you only need to put in the full path name if you are not currently in the directory that the file is in.

 

What Directory Am I In?

pwd    # print working directory

 

Delete File

rm filename        # delete a file in the current dir
rm /var/filename   # delete a file

Be aware of deleting files, there is no recycle bin. Sometimes it may be best to just rename a file, and only delete it when you are 100% sure.

 

Delete File

rm filename        # delete a file in the current dir
rm /var/filename   # delete a file

 

Super User
Some times you may need Administrator rights to do things. To trigger this option, providing your user account has privileges, start your command with sudo. This will first prompt for your password, but will only do this the first time.

sudo cp oldfilename newfilename
sudo rm filename

 

Using VI!
You may need to edit text files, and one software that people love to hate is Vi. To open a text file in Vi simply call it.

vi filename        # basic call
sudo vi filename   # if permission needed

Using vi can be frustrating. But in time you’ll learn to love it 🙂

esc      # cancel command
i        # start insert text
dd       # delete line
x        # delete character
:q!      # quit without saving
Hold Shift + Z Z  to quickly save and exit.

There are lots of commands, and will take you ages to remember them all. Just remember the basics, or quickly google them if needed.

That’s my quick guide. This should get you started. Maybe in time, I will make a more advanced command list, or pick a few and go into more details. I hope this helps.

Tags: , , , , , ,

Join the conversation...

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.