Basic Linux Commands ..

Spud1200

Fully Optimized
Messages
2,542
Location
England, UK
If you're looking to to do simple tasks in Linux then using the GUI can accomplish most things but at some point you will have to interact with with whats know as the terminal or the Linux shell.

In the terminal you can pretty much anything you want and knowing some commands to help you navigate around your system will greatly help a lot.

So Linux commands ..

pwd , This stands for present working directory. if you type pwd in too your terminal you will be given the full path of the directory you are currently working in.

ls , the ls commands is used to list all the contents of a directory.

ls -a , using the ls command with the argument -a will list all files and folders in a directory including hidden files and folders .

cd , this stand for change directory. so if you in the terminal and you wish to change to your directory of downloads folder. You'll type cd Downloads .

mkdir , this command is used to make a directory.

rmdir
, this command is used to remove a directory.

Note: If you wish to make or remove a directoy say for example, test folder. Say you wish to remove this directory. You'll type rm test\ folder . As this folder has two words describing the title of it you'll use the backslash to identify it.

touch , the touch command is used to create a file. It can be anything you want. So say for example touch hello_world.txt would create the file text file hello_world .

man
, the manual pages are very useful and if your struggling with how to use a command properly use the man command. for example, man ping will bring up the full manual pages for the ping command. If you wish to exait the man pages them selves then use just q for quit.

cp
, cp command is used to copy files and folders. use the cp command to copy the name of the file you wish and then followed by the destination. For example. cp hello_world.txt home/Spud1200/downloads/hello_world.txt ..

mv
, the mv command is used to move files and folders around the system using the command line interface. It takes two arguments . For example . mv hello_world.txt world.txt, we can rename the file it self .

locate
, loacte is just that. It will locate a file or folder for you if you are unsure were it is loaced at. Use the -i option to ignore weather the file or folder is case sensitive .

nano
, nano is a text editor in linux. type nano followed by the actual file name. If you wish to create a simple empty text file using nano simply type nano .

sudo
, the sudo command is used for administrator tasks. It stands for super user do. Like in windows you have the administrator, using sudo in linux provides you with elivated privlages. For example, sudo apt-get update .

df
, the df command is used to show you mounted partitions and their free space available for each drive within the sehll termianl. Use the df -m to see this information in megabytes .

du
, du command is used to display the disk usage. for example you can type du hello_world.txt and this will give an output for the actual file of hello_world.txt in bytes .

zip
, use the zip command to zip up a file or folder. For example zip hello_world.txt
unzip , same as before except this command will unzip the actual file. For example unzip hello_world.txt .

uname
, this command will print in the shell the Linux distribution information type uname -a to print to screen the full distrobution including for example the kernel version ect .

apt-get
, use the apt-get command to install packages in Linux. for example, sudo apt-get install bleachbit will install the program bleachbit.

apt-cache search
, this command will search the repository's for a given key word of your choice . For example, sudo apt-cache search bleachbit .

hostname
, this will give you the host name of your system running on a network. use hostname -i to show the ip address .

ping
, using the ping command will tell you how standle you line is in regards to any dropped packets on your network and will also tell you if you have an active out going connaction. For example. Pining googles servers you would type ping 8.8.8.8 to see if their is a stable connection and no packet loss.

Clear
, this will clear your full terminal of any information and bring you back to a blank screen .

Ctrl
& c , will safely stop a command prom processing in the terminal.

Ctrl
& z , this will force stop a command from executing .

exit
, typing exit will exit the terminal .

reboot
, typing reboot will reboot the system from the POST (Power On Self Test) , for example, sudo reboot .

top
, typing top in your terminal will list all the running process on your system .

kill
, use the kill command to kill a process . Using the top command to find out the process is and kill it. For example kill "process id inserted here" .

service
, this this command to list all services running on your system . For example service --status-all . To print a detailed status of a particular service type service "service name inserted here" status . If you wish to restart a service type sudo service "service name here" restart .


Using the CLI (Command Line Interface) really comes in to its own when you mix multiple commands and execute multiple commands at once . The CML or sell is a very powerful interface to be working with and you need to make sure that you do not accidentally run commands that will bork your system, for example using the sudo command and running system tasks as administrator .

Thanks for reading and I hoped that helped a bit ..
 

Yami

Lady Techie
Messages
8,193
Location
UK
This guide could be very useful though if i ever decide to switch to linux...
(Which will probably never happen...)
I'd recommend running a combination of both. Some things are much easier and nicer to do in Linux, so I'm usually SSH'd into my Linux server from my main Windows machine, which is mostly for gaming.
 
Top Bottom