Thursday, May 16, 2013

UNIX/Linux/Ubuntu system administration DAY 03

1. Delete line(s) in a text file

%sed -e '/pattern/d' foo.txt > new_foo.txt

If the keyword has spaces or special characters, use this

%sed -e "/pattern/d" foo.txt > new_foo.txt

2. List only usernames in linux/unix systems 

Type the following awk command:
$awk -F':' '{ print $1}' /etc/passwd

3. Login definition file is at /etc/login.defs
 
This login.defs file contains the starting and ranges of UID for users and groups, password aging controls (e.g. maximum number of days a password may be used, minimum acceptable password length, etc.), default UMASK, use MD5 or DES to encrypt password, etc.)


4. Stop the network interface eth0:
        ifdown eth0


5. Start the network interface eth0:
        ifup eth0


6. Restart all the networks services:

        /etc/init.d/networking restart

7. Display various network interfaces

        /sbin/ifconfig -a

8. Add a default gateway of 192.168.0.1
        route add default gw 192.168.0.1

9. To learn about kernel
        differences between
        $uname -a
        shows machine name and detailed hardware information

        and

        $cat /proc/version
        shows gcc version

10. term, xterm and uxterm
        differences between them
        term: terminal, which is in the Ubuntu default software, is the gnome-terminal.
        The gnome-terminal has more features than xterm.
        xterm: is minimalistic
        uxterm: is xterm with the support of Unicode characters

No comments:

Post a Comment

Mounting USB drives in Windows Subsystem for Linux

Windows Subsystem for Linux can use (mount): SD card USB drives CD drives (CDFS) Network drives UNC paths Local storage / drives Drives form...