Tuesday, December 24, 2013

Career Options

Career Options With Linux

- Red Hat/CentOS/Ubuntu/Debian Linux
- VMware vSphere virtualisation
- F5 load balancers (Local Traffic Manager (LTM) versions 9, 10 and 11)
- Cisco Ironport
- Puppet
- Git, Subversion code repositories
- Postfix, Qmail SMTP
- Dovecot, Courier IMAP/POP3
- Amavis, Spamassassin, ClamAV email filtering
- Bind, PowerDNS auth/caching/recursive DNS
- Apache web server
- Squid proxy server
- MySQL, PostgreSQL
- Bash/Shell scripting
- Zimbra Collaboration Suite
- Sophos Puremessage
- Nagios monitoring
- Cacti/MRTG
- Request Tracker
- ProFTPd, vsftpd FTP servers
- IBM storage
- Netapp Filer storage
- IBM xSeries servers
- IBM FlexSystem
- Apache Tomcat
- Red Hat Satellite
- Samba
- Net-SNMP
- Datacentre management
- Vendor relations

Wednesday, December 18, 2013

Something on /var/log

Reference :http://code-on.blogspot.in/2013/12/common-linux-log-files-name-and-usage.html?goback=%2Egde_3124596_member_5818723087679512579#%21

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/var/log/messages– Contains global system messages, including the messages that are logged during system startup. There are several things that are logged in /var/log/messages including mail, cron, daemon, kern, auth, etc.
/var/log/dmesg– Contains kernel ring buffer information. When the system boots up, it prints number of messages on the screen that displays information about the hardware devices that the kernel detects during boot process. These messages are available in kernel ring buffer and whenever the new message comes the old message gets overwritten. You can also view the content of this file using the dmesg command.
/var/log/auth.log – Contains system authorization information, including user logins and authentication machinsm that were used.
/var/log/boot.log – Contains information that are logged when the system boots
/var/log/daemon.log – Contains information logged by the various background daemons that runs on the system
/var/log/dpkg.log – Contains information that are logged when a package is installed or removed using dpkg command
/var/log/kern.log – Contains information logged by the kernel. Helpful for you to troubleshoot a custom-built kernel.
/var/log/lastlog– Displays the recent login information for all the users. This is not an ascii file. You should use lastlog command to view the content of this file.
/var/log/maillog /var/log/mail.log – Contains the log information from the mail server that is running on the system. For example, sendmail logs information about all the sent items to this file
/var/log/user.log – Contains information about all user level logs
/var/log/Xorg.x.log – Log messages from the X
/var/log/alternatives.log – Information by the update-alternatives are logged into this log file. On Ubuntu, update-alternatives maintains symbolic links determining default commands.
/var/log/btmp (lastb command; shows all bad login attempts)  /var/log/wtmp (displays all users logged in and out since the file is created...last command;login attempts)– This file contains information about failed login attemps. Use the last command to view the btmp file. For example, “last -f /var/log/btmp | more”
/var/log/cups– All printer and printing related log messages
/var/log/anaconda.log – When you install Linux, all installation related messages are stored in this log file
/var/log/yum.log – Contains information that are logged when a package is installed using yum
/var/log/cron– Whenever cron daemon(or anacron) starts a cron job, it logs the information about the cron job in this file
/var/log/secure– Contains information related to authentication and authorization privileges. For example, sshd logs all the messages here, including unsuccessful login.
/var/log/wtmp  or /var/log/utmp– Contains login records. Using wtmp you can find out who is logged into the system. who command uses this file to display the information.
/var/log/faillog– Contains user failed login attemps. Use faillog command to display the content of this file.

Saturday, August 3, 2013

linux newbie command

http://www.efytimes.com/e1/fullnews.asp?edid=112641


1. tar command examples

Create a new tar archive.

$ tar cvf archive_name.tar dirname/


Extract from an existing tar archive.

$ tar xvf archive_name.tar


View an existing tar archive.

$ tar tvf archive_name.tar


2. grep command examples

Search for a given string in a file (case in-sensitive search).

$ grep -i "the" demo_file


Print the matched line, along with the 3 lines after it.

$ grep -A 3 -i "example" demo_text


Search for a given string in all files recursively

$ grep -r "atithya" *


3. find command examples

Find files using file-name ( case in-sensitve find)

# find -iname "MyCProgram.c"


Execute commands on files found by the find command

$ find -iname "MyCProgram.c" -exec md5sum {} \;


Find all empty files in home directory

# find ~ -empty


4. ssh command examples

Login to remote host

ssh -l jsmith remotehost.example.com


Debug ssh client

ssh -v -l jsmith remotehost.example.com


Display ssh client version

$ ssh -V
OpenSSH_3.9p1, OpenSSL 0.9.7a Feb 19 2003


5. sed command examples

When you copy a DOS file to Unix, you could find \r\n 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/ /'


6. awk command examples

Remove duplicate lines using awk

$ awk '!($0 in array) { array[$0]; print }' temp


Print all lines from /etc/passwd that has the same uid and gid

$awk -F ':' '$3==$4' passwd.txt


Print only specific field from a file.

$ awk '{print $2,$5;}' employee.txt


7. Sort command examples

Sort a file in ascending order

$ sort names.txt


Sort a file in descending order

$ sort -r names.txt


Sort passwd file by 3rd field.

$ sort -t: -k 3n /etc/passwd | more


8. export command examples

To view oracle related environment variables.

$ export | grep ORACLE
declare -x ORACLE_BASE="/u01/app/oracle"
declare -x ORACLE_HOME="/u01/app/oracle/product/10.2.0"
declare -x ORACLE_SID="med"
declare -x ORACLE_TERM="xterm"


To export an environment variable:

$ export ORACLE_HOME=/u01/app/oracle/product/10.2.0


9. xargs command examples

Copy all images to external hard-drive

# ls *.jpg | xargs -n1 -i cp {} /external-hard-drive/directory


Search all jpg images in the system and archive it.

# find / -name *.jpg -type f -print | xargs tar -cvzf images.tar.gz


Download all the URLs mentioned in the url-list.txt file

# cat url-list.txt | xargs wget –c


10. ls command examples

Display filesize in human readable format (e.g. KB, MB etc.,)

$ ls -lh
-rw-r----- 1 atithya team-dev 8.9M Jun 12 15:27 arch-linux.txt.gz


Order Files Based on Last Modified Time (In Reverse Order) Using ls -ltr

$ ls -ltr


Visual Classification of Files With Special Characters Using ls -F

$ ls -F


11. pwd command

pwd is Print working directory. What else can be said about the good old pwd who has been printing the current directory name for ages.

12. cd command examples

Use “cd -” to toggle between the last two directories

Use “shopt -s cdspell” to automatically correct mistyped directory names on cd

13. gzip command examples

To create a *.gz compressed file:

$ gzip test.txt


To uncompress a *.gz file:

$ gzip -d test.txt.gz


Display compression ratio of the compressed file using gzip -l

$ gzip -l *.gz
         compressed        uncompressed  ratio uncompressed_name
              23709               97975  75.8% asp-patch-rpms.txt
14. bzip2 command examples To create a *.bz2 compressed file:
$ bzip2 test.txt
To uncompress a *.bz2 file:
bzip2 -d test.txt.bz2
15. unzip command examples 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
16. shutdown command examples Shutdown the system and turn the power off immediately.
# shutdown -h now
Shutdown the system after 10 minutes.
# shutdown -h +10
Reboot the system using shutdown command.
# shutdown -r now
Force the filesystem check during reboot.
# shutdown -Fr now
16. ftp command examples Both ftp and secure ftp (sftp) has similar commands. To connect to a remote server and download multiple files, do the following.
$ ftp IP/hostname
ftp> mget *.html
To view the file names located on the remote server before downloading, mls ftp command as shown below.
ftp> mls *.html -
/ftptest/features.html
/ftptest/index.html
/ftptest/othertools.html
/ftptest/samplereport.html
/ftptest/usage.html
17. ps command examples ps command is used to display information about the processes that are running in the system. While there are lot of arguments that could be passed to a ps command, following are some of the common ones. To view current running processes.
$ ps -ef | more
To view current running processes in a tree structure. H option stands for process hierarchy.
$ ps -efH | more
18. Network related commands

/sbin/ifconfig –a
/sbin/ip addr show
/bin/netstat –nrv
cat /etc/sysconfig/network



Saturday, May 18, 2013

Linux interview questions --- runlevel

Run level



http://www.linfo.org/runlevel_def.html


Runlevel Definition


A runlevel is a preset operating state on a Unix-like operating system.
A system can be booted into (i.e., started up into) any of several runlevels, each of which is represented by a single digit integer. Each runlevel designates a different system configuration and allows access to a different combination of processes (i.e., instances of executing programs).
The are differences in the runlevels according to the operating system. Seven runlevels are supported in the standard Linux kernel (i.e., core of the operating system). They are:

0 - System halt; no activity, the system can be safely powered down.
1 - Single user; rarely used.
2 - Multiple users, no NFS (network filesystem); also used rarely.
3 - Multiple users, command line (i.e., all-text mode) interface; the standard runlevel for most Linux-based server hardware.
4 - User-definable
5 - Multiple users, GUI (graphical user interface); the standard runlevel for most Linux-based desktop systems.
6 - Reboot; used when restarting the system.
By default Linux boots either to runlevel 3 or to runlevel 5. The former permits the system to run all services except for a GUI. The latter allows all services including a GUI.
In addition to the standard runlevels, users can modify the preset runlevels or even create new ones if desired. Runlevels 2 and 4 are usually used for user defined runlevels.
The program responsible for altering the runlevel is init, and it can be called using the telinit command. For example, changing from runlevel 3 to runlevel 5, which allows the GUI to be started, can be accomplished by the root (i.e., administrative) user by issuing the following command:
telinit 5
Booting into a different runlevel can help solve certain problems. For example, if a change made in the X Window System configuration on a machine that has been set up to boot into a GUI has rendered the system unusable, it is possible to temporarily boot into a console (i.e., all-text mode) runlevel (i.e., runlevels 3 or 1) in order to repair the error and then reboot into the GUI. The X Window System is a widely used system for managing GUIs on single computers and on networks of computers.
Likewise, if a machine will not boot due to a damaged configuration file or will not allow logging in because of a corrupted /etc/passwd file (which stores user names and other data about users) or because of a forgotten password, the problem can solved by first booting into single-user mode (i.e. runlevel 1).
The runlevel command can be used to find both the current runlevel and the previous runlevel by merely typing the following and pressing the Enter key:
/sbin/runlevel
The runlevel executable file (i.e., the ready-to-run form of the program) is typically located in the /sbin directory, which contains mostly administrative tools and which by default is not in the user's PATH (i.e., the list of directories in which the system searches for programs). Thus, it is usually necessary to type the full path of the command as shown above rather than just the name of the command itself.
The default runlevel for a system is specified in the /etc/inittab file, which will contain an entry such as id:3:initdefault: if the system starts in runlevel 3, or id:5:initdefault: if it starts in runlevel 5. This file can be easily (and safely) read with a command such as cat, i.e.,
cat /etc/inittab
As an alternative to telinit, the runlevel into which the system boots can be changed by modifying /etc/inittab manually with a text editor. However, it is generally easier and safer (i.e., less chance of accidental damage to the file) to use telinit. It is always wise to make a backup copy of /etc/inittab or any other configuration file before attempting to modify it manually.







Sunday, February 10, 2013

Box Cloud on Linux

Ref Link :

http://linuxfordummies.org/mount-your-box-com-account-in-linux/



Mount Your Box.com Account In Linux

 
Apr
9
10

Box BannerBox.net (box.com actually now) is a service that enables you to have a place to put files that you want to access from anywhere. Some people use it to back up their workstations. Did your box.net mount start failing recently? They’ve changed a couple things.. use this guide to set it up again. First thing we need to do is to install davfs. You can do that with one of the following commands, depending on what package manager you use on your Linux distro: RedHat based systems:
yum install davfs2
Debian based systems:
apt-get install davfs2
Now, add the mount point:
mkdir /box
Add this line to your /etc/fstab:
https://www.box.com/dav /box davfs rw,user,noauto 0 0
Add this line to the bottom of the /etc/davfs2/secrets file (replace with your email address and password)
https://www.box.com/dav user@email.com password
Edit the /etc/davfs2/davfs2.conf and change the following line:
# use_locks 1
And change it to this:
use_locks 0
Now we can mount it. To do that, use the following command:
mount /box
Show that it’s there with ‘mount’ or with ‘df’ Now, rsync something to it. Here, i’m rsyncing a 1gb tar.gz file:
[root@britannia home]# rsync -avz --progress somefile.tar.gz /box/
sending incremental file list
rob-test.tgz
  1154875454 100%   61.06MB/s    0:00:18 (xfer#1, to-check=0/1)
sent 1155263231 bytes  received 31 bytes  59244269.85 bytes/sec
total size is 1154875454  speedup is 1.00
[root@britannia home]#
And that’s it. You should be good to go at this point.

10 Responses to “Mount Your Box.com Account In Linux”

  1. eric says:
    Add this line to your /etc/fstab:
    https://www.box.com/dav /box davfs rw,user,noauto 0 0
    how do I do that? I am REALLY ubuntu dummy :)
    many thanks
    e
    Reply
    • Cliff says:
      You need to edit the file as root user, or use sudo. Just make sure you make a backup copy of the original file BEFORE you edit the file.
      If you are on IRC in #Ubuntu on irc.freenode.net someone there can help you or you could join my #LFD channel and someone there can possibly help you.
      Reply
  2. WallStud says:
    Awesome! Works like a champ! Thanks!
    Reply
  3. Ian says:
    Your upload bandwith is about 1000 times mine :-(
    Obviously, there is no way to cheat during the initial upload. But what about incremental updates? Is there any way to “really” use rsync with box.com, that is, a rsync server to connect to, rather than using it as a completely dumb and extremely slow hard drive?
    Reply
    • Pawel says:
      To use rsync for real incremental backups (that is – updating only the files which changed) with box.net mounted as a davfs an additional option –size-only has to be used, as I found here: http://tomalison.com/reference/2010/04/03/webdav/
      The command would be then:
      rsync -rvz –size-only “~/myfolder/” “~/box.net/”
      With the standard -u (for update) it will not work – it will always copy all the files from scratch.
      Reply
      • CBee says:
        Nice to see box.com uses standards like webdav / davfs. That leaves openings for opensource to work on. Meanwhile users can scan the internet for nice combinations like rsync and davfs.
        Next thing is an extension to rsync to be able to coop with webdav / davfs issues and use them to lean and mean the transfer.
        Reply
  4. Brian says:
    like linux, let’s go open source guys…
    Reply
  5. edd says:
    thannks, work very well but i can not copy a file directly in /box with tunar xfce4
    Reply
  6. qm-b says:
    Awesome! Thanks for help! Works great..
    Reply
  7. Mike says:
    Should this still be working? I am getting “rejected Basic challenge” errors.
    Reply

Monday, February 4, 2013

Google drive -in Linux via Insync

http://www.howopensource.com/2012/11/install-insync-google-drive-client-in-ubuntu-12-10-12-04-ppa/


Insync is a Client for Google Drive / Docs, Using Insync Google Drive Business users or power users can sync and share files easily. Insync is now available for Linux. It supports Multiple accounts, Offline Google Docs editing using the local applications and Recent changes notification. Insync (Google Drive for Linux) can be download and install from their site or you can install it using their official repository(PPA).

To add PPA in Ubuntu

First add the Insync public GPG key for authentication. Run the below command in the terminal and issue the password for the user, when prompted.

wget -O - https://d2t3ff60b2tol4.cloudfront.net/services@insynchq.com.gpg.key | sudo apt-key add -

After adding the key, Copy and paste the below command to add Insync repository to your apt repository.

sudo sh -c 'echo "deb http://apt.insynchq.com/ubuntu $(lsb_release -sc) non-free" >> /etc/apt/sources.list.d/insync.list'

Now update your repository by running the below command.

sudo apt-get update

To install Insync in Ubuntu

For Unity & Xfce Users:

sudo apt-get install insync-beta-ubuntu


For GNOME Shell users:

sudo apt-get install insync-beta-gnome

For Cinnamon Users:

sudo apt-get install insync-beta-cinnamon

For KDE 4 Users:

sudo apt-get install insync-beta-kde

That’s it. Insync is installed and ready to sync Google Drive files.

Go to Dash and type Insync, and start the application by selecting it.