Welcome to Linux Forums! With a comprehensive Linux Forum, information on various types of Linux software and many Linux Reviews articles, we have all the knowledge you need a click away, or accessible via our knowledgeable members.
Find the answer to your Linux question:
Write an article for LinuxForums Today! Win Great Prizes!
Linux terminal or shell is the most powerful tool in the operating system. Windows has its own shell(cmd). However, it is not as powerful as the Linux shell. In Linux there are many shells to choose from, the default shell in Ubuntu distributions is the bash (born again shell). Shell accepts commands that you input from keyboard and passes them (if syntax is correct) to the kernel for execution. In this tutorial we will cover some of the most used shell commands.
I have recently migrated from Ubuntu 8.04 to Ubuntu 11.10 (was not easy to be honest as many things have been changed) only to find out that the terminal window has been removed from the Taskbar/Launcher ! I know that they are trying to convert many people from Windows to Linux, but why did they hide the most powerful tool?! It really baffles me. Well this is another topic that I will discuss in future articles. At first let us see how many types of shells are available in your O.S. To do that simply open a terminal (by holding ALT+CTRL+T). Below is a list of the most common shell commands with examples to illustrate how they work:
1- To list the number of shells you have in your system type:
2- To know which shell you are currently using type:
3- To switch between different shells type:
Enter your password.
Then type the path of the required shell (e.g. /bin/tchs)
4- To show the current directory that you are in type:
5- The command cd lets you navigate between directories. Below is an example:
Suppose that you are in the working directory /home/yourname/ and you want to move to another directory that is not hierarchically above it or below it , you should
include the full path of the destination directory as the following:
It also can access the directories hierarchically below and above the working directory. To move to a directory below the working one you should type:
(if Documents directory exist under yourname directory).
To go one level up(access the parent directory) simply type:
6- To make a new directory type the following command:
mysecrets will be created as a directory inside the working directory.
7- To delete the directory which we have just created type:
8- To display the free space in your disk type:
This command will show the free space in terms of blocks. To make it more human readable type:
This should output the space calculated in GB/MB.
9- To list the files within a directory type:
10- To copy files to a different directory or to a new file within the same directory type (accordingly):
11- To change your password simply type the following command:
You will be asked to enter your current password. Then you will be asked to enter your new password and to confirm it by retyping.
12- To change The access privileges/permissions for a particular file or directory, there are different ways to do it. However, as this tutorial is targeting Linux new
comers so I shall use the simplest way. At first let us understand what are the following letters stand for:
u= user who owns the file. g= the group which own the file. o= others. a=all.
r= permission to read. w=permission to write. x=permission to execute.
Suppose that we want to change the access permissions for a directory called 'Documents'. At first we should move to its parent directory with the 'cd' command as
explained above then do the following:
$chmod u-rwx Documents
This will remove all the permissions for the user and he/she would not be able to access 'Documents'. If you want to regain these permissions type the following:
$chmod u=rwx Documents
The same command applies for the group (g) and the others (o) just by replacing the letters accordingly.
N.B (It dose not necessary means that you should include all permissions. You can add or remove a single or double permission/permissions regarding who is accessing the directory).
To change the access permissions for a file is the same as for directories. You only replace the directory name with the file name followed by the extension.
13- To see current running processes type the following command:
14- to kill/stop the running processes you there are two ways:
By using the PID which you find by running the 'ps' command. It should look like this:
Or by using the process name which also can be found by running the 'ps' command :
To stop all processes except your shell type:
All of the above mentioned commands you can make them more precise or acting in a different way by adding arguments. You can find what and how to use these arguments by typing 'man' followed by the command that is in context. (e.g. $man ps).
In the next tutorial we will install and configure Java, Mysql and glassfish server.
My name is Amin Salim and I am Sudanese born in Kuwait. I hold a degree in Information Systems (BSC) from the University of Leeds. I have worked as a research assistant for a local expertise and consultancy firm called (SUDEXAM). Then I travelled to Sierra Leone and worked for the project development unit as an Information Systems engineer. My role was doing the financial analysis and the whole editing for the feasibility studies and providing technical support. I am flexible, and a good team player as realized from conducting feasibility studies with people from different backgrounds and qualifications. Afterwards I came back to Sudan and worked as self-employed software engineer and have developed a system by myself from scratch for a charity eye-hospital. The system functionality was to keep track of stock and sales (written in Java). I am very versatile individual as proven from working on different disciplines and always looking to improve my skills.
Thanks - interesting. I loved DOS in the old days, so this is a nice feature - have used it for the first time this week with redirection commands to list files into a file to use as an index that can be printed.
RE: Terminal written by trevcharl:
Comment title: * please do not put your response text here