Tuesday, 4 March 2014

Job Scheduling with 'at' command in Linux Ubuntu

"at" command takes an argument time on which the job is executed and then displays at $prompt.
example:-

at 17:00
then press enter.

at 5:00 pm
then press enter

at>sh.my.sh
then press enter
In above command it will execute my.sh file at 5 pm.

these above at command will be executed in $ prompt.
Ctrl+d to exit from at prompt.

Note:- The "-f " option is used to take commands from the file and "-m " option is used to send jobs completion report to the specified user.

at -m -17:00
then press enter.

Note:- "at" command also offers may keywords like now,noon,today,midnight,tomorrow and also accepts
+ symbol to act as an operation.

example:-

at now +1 year
then press enter

at 5:00 pm +1day
then press enter

at 5:00 pm December 25,2016
then press enter

at 10 am tomorrow

Note:- The jobs list display with "at -l" command.

"at -r" command is used to remove all the jobs from the list. 

Monday, 3 March 2014

How to assign permission remove permission to a file

"chmod" command is used to set file permissions in Linux.
we can also use six different options for assign permission or remove permission -
for assign permission to file we can use =
+r
+w
+x

for remove permission to file we can use =
-r
-w
-x

example :-

chmod +x abc.sh

How to execute a job below low priority with nice command

nice -n
nice -n 5% server.out
nice -n 15% clint.out
cc my.c -0 my.out

in above command -0 is used to produced user define output file.
./my.out
for execute out file
pwd then press enter

Job execution with low priority with nice command

All jobs in linux or unix platform normally executed with equal priority which is not desirable because high priority jobs  must be completed all the earliest.
the "nice" command is used with "% sign" to reduce the priority of the job.
Note:- the "nice" vlaues are system depends and typically use "nice" values from 1 to 19.
Commands -

the ps -0 nice

this above command display nice values which are supported by operating system. 

For loop syntax in shell script

with the help of this post you can also know that how to use for loop in Linux Ubuntu.
syntax of for loop in shell script:-

for((initialization; condition; increment/decrements ))
do
------------------
------------------
------------------
------------------
done

While loop syntax in shell script

with the help of this post you can also know that how to use while loop in Linux Ubuntu.
syntax of while loop in shell script:-

while test condition
do
------------------
------------------
------------------
------------------
done 

How to use system variables in Linux Ubuntu

If we want to use system variables then see following example:-

set 10 20 30

echo $1

output = 10

in above given small program we can see that set keyword sets the system variables values and when we echo $1 then it prints our set variable value.

In linux when we pass parameter in shell script then Linux automatically create a variable $#.
$# counts total number of command line argument which has passed.

How to create System variables in Linux Ubuntu

System variables is very useful part in linux shall script programming .for create system variables in  a shall script program you just have to use below syntax :-

set $a $b $c

set keyword is used to set system variables. and $ sign  is used to declare variable in Linux ubuntu.

Thursday, 27 February 2014

How to open A shall script file in Linux Ubuntu

If we want to open a new shall script file on your computer then fist we just have to right click on your computer screen then just click on open terminal option where we can see the $ prompt now do as below:-

newfilename.sh

Here newfilename is the name of your shall script file and .sh is the extension of your file.

How to save a already make file in VI text editor in Linux Ubuntu

If we have a already file which is make in vi editor and we want to save that file again with our changes in the file then we just have to follow below steps:-

  1. first press ESC key.
  2. then press :
  3. then press w
  4. then enter key.
Here you go now your file is saved with your changes.  

How to run shall script program in Linux Ubuntu

If we want to run shall script program into Linux Ubuntu the first right click on computer screen then just click on open terminal now you can see $ prompt on your screen now just run below command :-

sh my-program.sh

in above command sh stands for shall script then your program name and then .sh extension of the file then just press enter.  

How to save files in VI text editor in Linux Ubuntu

After inserting data into vi editor file you have to save that data for saving that data you just have to follow below steps :-
  1. First press ESC key.
  2. Then press :
  3. then press w key
  4. then after space just type the file name and press enter key.
Here you go your file is saved with your given name for your help i am going the command below again :-

:w myfile

How to insert data in VI text editor

If you want to insert data in VI text editor then first you have goto $ prompt and the just type vi and the just press i key of your keyboard.
"i" is used to insert data into vi text editor.

How to open VI text editor in Linux Ubuntu

If we want to open VI text editor in our system then just first right click on your Linux Ubuntu computer screen and click on "Open terminal " then you have see a $ command prompt terminal on your screen then just type vi then press enter as below:-

vi 

How to show all directory list in $ prompt in Linux Ubuntu

If we want to know all directory  list in our computer then we have to type the following command in $ prompt on our Linux Ubuntu terminal screen :

ls -l 

This command is show all the directory list in Linux Ubuntu .

How to direct exit without saving file in VI editor in Linux Ubuntu

As we all know that we have use VI editor in Linux Ubuntu for making text files,shall script files and c++ program files and etc.

some times we open the VI editor and don't know how to close it without saving the files so there is two different ways to exit the VI text editor without saving the file :-

1. Just press "ctrl+z "

2. First press ESC key then press : (colon) then q then ! then enter as below

:q! then enter

Wednesday, 26 February 2014

How to GOTO GUI mode from Command Mode in Linux ubuntu in Multi user Mode

If we are in GUI(Graphical user Mode) mode and we want to go back into Command Mode in Linux then we just have to press below keys :-

ctrl+alt+backspace


How to GOTO command mode from GUI Mode in Linux ubuntu

If we are in command mode and we want to go back into GUI(Graphical user mode) in Linux then we just have to goto in $ prompt in our command  mode and type below command :-

startx 

then press enter it takes a while to open your GUI mode.

Note :- Linux Ubuntu is case sensitive so use commands as i type above.