Linux Commands For Beginners – A Tutorial

I was introduced to this Linux system by the age of 12 – That might make an idea in your mind why am i a tech article writer and a web developer. Because i was simply born for this. I love to discover new technologies, break them apart, look in them, realize what they do, how they function, and build a new mechanism on the idea of that mechanism i studied (usually better and more performant)

And that is the fun in it. But not everybody has free time like me. Or a mind like mine, so i decided to write this simple tutorial on how to use Linux commands. I have gone through so many problems on Linux that i have figured almost everything out, so you don’t have to go through what i did (it was fun as hell to solve problems though).

In this article, i will enlist the most useful Linux commands, and some examples of their usage so you have a better idea of what to do with them. Sure, there are thousands of GUI tools on Linux for each command on Linux, but using the command line will give you more power on the overall operation of the system.

So let’s start!

1 – ls

ls (list) is the command in linux to list the files in the current directory, or if you add the directory path as a parameter, of that directory. It is a part of GNU Coreutils right now but it was around since the dawn of the Unix system.

To make a list of all the files and folders in the current directory, just type:

# ls

Or if you want to make a list of the files and folders in ANOTHER directory, just go:

 #ls /path/to/folder

2 – cd

From Change Directory, this command lets you change the working directory for your current virtual terminal. For example, if you wanted to see the files in the /etc directory, you can combine ” cd ” with ” ls ” by doing:

  #cd /etc
  #ls
  ...list of files here

3 – man

The default viewer for the manual pages in Linux, it is used to view the vast documentation in /usr/share/man and /usr/share/doc folders available to both developers and end-users.

Usage:

 # man bash

Will give you the manual documentation for bash.

I used this to read up on the libc and socket function references and it is a great command line tool. To navigate a document, just press the Up and Down keys.

4 – ifconfig

ifconfig is a command line tool for operating on your wife, or ethernet card.

the usage basically is:

<pre> ifconfig [your-device-here] [your-command-here] </pre>

Where device-name is your device name,  and the command is either “up” for enabling the device, or “down” to bring down the network interface.

5 – rp-pppoe tool

This is the tool i used in Romania for my RDS PPPoE connection and it is great. You do the setup by typing “pppoe-setup” (the rest is pretty self explanatory as the application explains what you need to do)

Then you fire off your connection by writing a simple “pppoe-start”, and when you decide that you consumed enough internet for today (i reach that conclusion whenever i visit 4chan) you type “pppoe-stop”.

There are distributions that don’t come out of the box with this though, so you will have to use your distributions package manager (and an internet connection other than rp-pppoe) to connect your PPPoE or ADSL Connection (if you have gnome installed though, you can use the GUI tool to connect to the internet in an easier fashion, so no lack of hope there!)

6 – ln

ln (Link) is a command to create shortcuts (symbolic links) to another files, executables, or folders. It is very useful for creating an abstract directory tree like:

  • /Applications -> /usr/bin or /usr/sbin
  • /Documents -> /home/username/
  • /Configuration -> /etc
  • /Removable Devices -> /mnt/

Making your main directory tree much prettier and easier to use.

Usage is like this:

 ln -s /existing/file /new/symbol/

Meaning /existing/file
being the existing file path, and the /new/symbol being the path to the symbol you want to create “i.e /home/jimmy/chromium”

This is one of the most useful tools in the Linux eco system and i would recommend you to learn it in depth by doing a “man ln” on the command line.

5 – telnet

Yeah, i know that telnet is available in Windows too, but they actually disabled it in Windows 7, and in Linux you can use it freely. Let’s just mention that.

6 – Sed

Sed is a search and replace tool used by system administrators and people that deal with text files a lot, here’s some usage:

When you copy a DOS file to Unix, you could find rn in the end of each line. This example converts the DOS file format to Unix file format using sed command.

$sed 's/.$//' filename

Print file content in reverse order

$ sed -n '1!G;h;$p' thegeekstuff.txt

Add line number for all non-empty-lines in a file

$ sed '/./=' thegeekstuff.txt | sed 'N; s/n/ /'

7 – Vim

Go to the 143rd line of file

$ vim +143 filename.txt
Go to the first match of the specified

$ vim +/search-term filename.txt
Open the file in read only mode.

$ vim -R /etc/passwd

8 – Export

The export command is used for storing configuration for the terminal (i.e $HOME equals /home/jimmy), here are some examples of usage:
To extract a *.zip compressed file:

$ unzip test.zip
View the contents of *.zip file (Without unzipping it):

$ unzip -l jasper.zip
Archive:  jasper.zip
Length     Date   Time    Name
——–    —-   —-    —-
40995  11-30-98 23:50   META-INF/MANIFEST.MF
32169  08-25-98 21:07   classes_
15964  08-25-98 21:07   classes_names
10542  08-25-98 21:07   classes_ncomp

There are much more tools to use, but i can’t fit them all in a 1000 article! Will talk in a later article about more. Until then, take care and keep learning!

Published
Categorized as News