Archive for the 'Linux' Category

Search a string in Linux

This is a full text search in all the files in the current directory and subdirectories.

grep –r “test” .

No Comments »

admin on December 3rd 2010 in Linux

Mount Windows Shares from Linux

Lists Shares
smbclient –U %USERNAME% –L %SERVER%

Command  
get Get Files from the Remote Machine
put Put Files on the Remote Machine

Mount Shares
Create a Mount directory and connect to it
mkdir %SHARENAME%
mount –t smbfs –o username=%USERNAME%,password=%PASSWORD% //%SHARENAME% %MOUNTDIRECTORY%

No Comments »

admin on November 11th 2010 in Linux

screen

Screen is a terminal multiplexer. It is very useful if you want to run multiple programs/scripts at the same time and want to switch between them. You don’t need to open another terminal for it and it even keeps them running when you logoff from the terminal.

To install screen type:
#apt-get install screen

To run it type
#screen

Here a couple of useful shortcuts (C stands for Ctrl)

Shortcut Description
C-a c Create a new window
C-a n Jump to the next window
C-a p Jump to the previous window
C-a A Set a window name
C-a “ Overview of all windows
C-a K Close window (kill)
C-a d Detach screen
C-a S Split screen horizontally
C-a | Split screen vertically
C-a Q Remove splits
C-a {Tab} Switch between the window

To list all detached screens:
#screen -list

To reattach a screen type:
#screen -r [Number]

To close a detached screens type:
#screen -S [Number] -X quit

No Comments »

admin on May 19th 2010 in Linux

Linux Network Testing

Tracert like in windows wit ICMP Echo request
#traceroute www.google.com –I

Show Routing Table
# nestat –nr
# route –n

Connection Statistic
# nestat –i
# mii-diag

Network Connections and Bind Ports
# netstat –a

Check DNS Settings
# dig www.google.com
# dig www.google.com mx
# nslookup www.google.com

I had to install the packages first to use this commands:
# apt-get install dnsutils

TCPDUMP
It is a very useful Network Sniffer for Linux. But first you need to install it:
# apt-get install tcpdump

Ex.
# tcpdump –nli eth0 port 80
# tcpdump –nli eth0 host 192.168.1.100 and port 80
# tcpdump –nli eth0 host 192.168.1.00 and not port 22
# tcpdump –nli eth0 src host 192.168.1.00 and not port 22

No Comments »

admin on May 18th 2010 in IT, Linux

Linux Network Settings

Check the state
# ifconfig –a

Activate/Deactivate Network Interface
# ifup eth0
# ifdown eth0

Hostname
# hostname
# uname -n
# vi /etc/hostname

Get an IP from the DHCP Server
# dhclient

Edit this file to setup a fix IP
#vi /etc/network/interfaces

auto eth0
iface eth0 inet static
      address 192.168.0.25
      netmask 255.255.255.0
      network 192.168.0.0
      broadcast 192.168.0.255
      gateway 192.168.5.1

# /etc/init.d/networking restart

Edit this file to setup DNS
#vi /etc/resolv.conf

order hotsts, bind
domain mydomain.local
nameserver 192.168.0.10

No Comments »

admin on May 17th 2010 in IT, Linux, Network

Manage Users in Debian

Create Groups
# group add finance
# group add development
# group add others

Create User and Assign to Groups
# useradd –m –g finance –G development,others –s /bin/csh testuser

Information about a User
# id testuser
# groups testuser

Modify and Delete a User
# usermod testuser
# userdel –r testuser

Deactivate User Account
# usermod –L testuser

Switch to a user and move to home directory
# su – testuser

Set a Password for a User
# passwd testuser

Set Password Policies
# chage testuser

User, Groups and Password Database
# /etc/passwd
# /etc/groups
# /etc/shadow

Template Directory for Home Folder
# /etc/skel/

No Comments »

admin on April 29th 2010 in Linux

Turn Off Annoying Bell in Debian

Edit the file with vim:
# vi /etc/inputrc

Remove comment:
set bell-style none

Or I prefer actually to have it visually displayed:
set bell-style visible

After that you need to restart debian.

No Comments »

admin on April 21st 2010 in Linux

PHP5 Interpreter Missing

Use following command in your shell:
#sudo apt-get install php5-cli

No Comments »

admin on February 25th 2010 in IT, Linux

sync time in debian with a ntp server

1. Install
apt-get install ntpdate

2. Create a new file in /etc/cron.hourly
#!/bin/bash
/usr/sbin/ntpdate your_timeserver >> /var/log/ntpdate.log

3. Give the file run rights
chmod +x file_name

No Comments »

admin on February 16th 2010 in IT, Linux

Install VMWare tools in debian

1. Install Kernel Heaeders

  1. Get the Kernel version and remember it with:
    uname-r
  2. apt-get install linux-headers-[Kernel Version]

2. Install VMWare Tools

  1. Choose “install and upgrade VMWTools in VMWare” in your VM menu
  2. mount /dev/hda /media/cdrom
  3. cd /media/cdrom/
  4. cp VMWareTools[whateverversion]tar.gz /tmp/
  5. cd /tmp
  6. tar xvzf VMWareTools[whateverversion]tar.gz
  7. umount /media/cdrom/
  8. cd /tmp/vmware-tools-distrib/
  9. make a symlink:
    ln –s /usr/src/linux-headers-[Kernel Version] /usr/src/linux
  10. apt-get install gcc-4.1
  11. change using gcc version:
    export CC=/usr/bin/gcc-4.1
  12. I had make and killall missing on my installation so can you get it:
    apt-get install psmisc make
  13. ./vmware-install.pl

3. Uninstall VMWare Tools
After a failed installation of VMWare Tools I got following message:
A previous installation of VMWare Software has been detected… You may want to re-install VMWare Tools.

The solution was to run the uninstaller first and run the VMWare setup again:
1. ./vmware-uninstall.pl

No Comments »

admin on February 2nd 2010 in Linux, VMWare




Check out new movies online website. Download and buy movies now.