Posts

Showing posts from November, 2016

grep command tutorial

What is grep? grep stands for G lobally search a R egular E xpression and P rint. Created by Ken Thompson, the author of B Programming Language. It is a command-line utility to search a particular string in the files. Usage 1: Search a particular word in file To search a particular word in a file. $ grep <word> <file to search> Eg. grep hello words.txt The above command searches for word "hello" in the file "words.txt" and prints the matching lines in which the word "hello" is present in the file . The above command by default performs case sensitive search, this means if there is "Hello" present in the words.txt file it won't be detected by the search. Usage 2: Case Insensitive word search in file $grep -i <word> <file to search> Eg: grep -i hello words.txt The above command performs case insensitive search and gives you "hello"  "Hello" or other variants in the search. Usa

U.S. Visa B1/B2 Interview Experience

FingerPrint: July 28 2016 Hyderabad Reach there before half an hour . Items to Take: DS160 Confirmation Page Appointment Letter Passport You cannot carry mobile phone and purse as well Once you reach there, you have to stand in a queue. At the starting of the queue, a person will be verifying the name and passport number on your DS-160 Form as well as on the passport. Once matched, they will allow you inside. After going inside, there will be a security Check. And you have to go to the counter where they will again verify your documents and attach a sticker to the passport. They will give you a token number and allow you to go inside the other room. Check the television to find out your counter. Once you reach your counter, the person will ask you for your documents. Then ask for the purpose of the visit, and then ask you to read a paragraph present on the right side. After reading, they will take your photograph and then the fingerprints and then give

cron tutorial 2 logging

Image
We have seen in our first part of cron tutorial how to schedule a particular job at a specified time. In this part, we will see how we can perform cron logging By default the cron jobs are logged in /var/log/syslog file If you want the cron logs to store it in a separate log file ( /var/log/cron.log) . Uncomment the line that starts with #cron*. /etc/rsyslog.d/50-default.conf If there is no such file present in /etc/rsyslog.d, create 50-default.conf file and add the following entry cron*.    /var/log/cron.log Restart rsyslog by running the following command : sudo service rsyslog restart Now all the cron logs will be stored in the /var/log/cron.log file You can also redirect the output of individual cronjobs to their own log files . */1 * * * * root /home/jamal/test.sh >> /var/log/test.log If you want to log both standard output as well as errors then use the following syntax */1 * * * * root /home/jamal/test.sh >> /var/log/test.log 2>&am

What is a Linux Distribution

A Linux distribution also called as Linux distro is a set of packages that together make up a operating system.  Each of the package provides a specific function to the system. Example of packages include: Linux Kernel: provides operating system features for example memory management, process management, multitasking etc X Server and the desktop environment GNU Shell Utilities: the terminal Others include : System Libraries, web servers, databases, e-mail utilities and more. There are different distros for different purposes.  Desktop Environment: Ubuntu, Fedora Server: Red Hat Embedded Systems: Buildroot, OpenWRT Installing software in these distros varies as each of them uses a different packaging mechanism. For example, software in ubuntu comes in <sw>.deb and installing it uses dpkg package manager. deb stands for debian.

How to change the password in ubuntu

Image
There are two ways by which you can change your existing password: Command Line: Linux provides passwd utility to change the user password 1.Open terminal ( CTRL+ALT+T) 2. Type passwd 3. Enter your current password 4. Enter the new password which you want to set 5. Re-Enter the new password to confirm GUI 1. In the Dash Home , type "System Settings" and open it 2. Click on User Accounts present in the bottom right and then click on "Unlock" 3. Type your current password to unlock and now the password tab is editable. You can modify it by clicking on the password text box.

cron tutorial

Image
What is cron? cron is a daemon available in UNIX based systems which runs in background and automatically executes scripts or commands  at the specified time mentioned by the user. Example Scenarios where cron can be useful Connecting to the Internet and downloading E-Mail Cleaning up personal temporary directory How to check whether cron is running or not On  most of the Linux distributions, cron is already installed and is started by the startup scripts. jamal@jamal-Lenovo-G580:~$ ps ax| grep "cron"  1356 ?        Ss     0:00 cron  3793 pts/0    S+     0:00 grep --color=auto cron The top line shows that the cron is running and the bottom is the one we have searched How to schedule a job in cron There are different ways to achieve this: 1. User specific 2. System Level System Level: In the /etc, there are subdirectories called cron.hourly, cron.monthly, cron.weekly and cron.daily. Place your script in any of these director