Linux Commands

1. Edit sources.list 
#vim(or gedit/nano) /etc/apt/sources.list
Comment:
  • deb http://172.16.9.46/debian lenny main contrib non-free(to link mirror machine)
  • deb http://ftp.au.debian.org/debian/ squeeze main contrib non-free(to link mirror machine)
  • deb http://www.debian-multimedia.org stable main(for all types of codecs)
  • deb http://http.us.debian.org/debian lenny main contrib non-free(if mirror machine doesn't work)
  • deb file:///media/diskname/mirrror_folder lenny main contrib non-free(local update)

#q to save
#Shift+Q+W and type x to exit.

2. Change password
root:
#passwd root
user:
#passwd username

3. Add new user
#adduser name

4. Delete user
#userdel name

5. List directory
#cd /home/jrabgay
#ls

6. rename files/folders
#mv example EXAMPLE

7. Remove
File:
#rm test.doc
Folder:
#rm -rf Documents

8. Install
#aptitude install name

9. update
#aptitude update

10. upgrade
#aptitude dist-upgrade

11. Safe upgrade
#aptitude safe-upgrade

12. Permission
#vim(or gedit) /etc/fstab
Insert (rw, user, noauto) in option category.

13. Mount external drives(in root)
#fdisk -l
#mkdir /media/disk
#mount /dev/sda1(check) /media/disk
#umount /media/disk

14. Extract RAR files
#aptitude install unrar
#cd .....(open location)
#unrar e filename

15. Run DVD author
#aptitude install dvdauthor
#cd .....(open location)
#dvdauthor -x movie.xml(refer to making of dvd files)

16. PDF conversion
#cd ....(open location)
#pdftops filename
#pdftoabw filename
#pdftotext filename

17. Display applications and check the size
#ls /usr/share/applications(display)
#du -sh /usr/share/name(size) OR /home/bhutan/filename

18. Check disk space
#df -h

19. Move files/folders
#mv /home/bhutan/name /home/bhutan/Desktop

20. Run SSH
#aptitude install ssh
#ssh username@ip_address
#password

21. Send files
#aptitude install openssh-server
#scp -r (or cp) /home/bhutan/name username@ip_address:/home/bhutan

22. Delete history commands
#history -c

23. restart internet
#/etc/init.d/networking restart

24. Recover Windows files using Linux Live CD
#aptitude install ntfs-3g
#fdisk -l
#mkdir /media/win
#mount -t ntfs-3g /dev/hda1 /media/win(Graphically), if not-
#cd /media/win
#ls and copy all files

25. Creat ISO directly from CD/DVD
#dd(disk dump) if=/dev/cdrom of=/media/common/test.iso

26. Take screenshot for whole applications
#gnome-screenshot -d (duration) 5 (time)

27. CPU information
#cat /proc/cpuinfo

28. Kernel version
#cat /proc/version or
#uname -r

29. Make ISO from files
#genisoimage(or mkisofs) -o /home/bhutan/test.raw /home/bhutan/filename
And later rename it to ISO

30. Join movies
#aptitude install ffmpeg
#cd ...(open location)
# cat movie1.mpg movie2.mpg | ffmpeg -f mpeg -i - -vcodec copy -acodec copy merged.mpg

31. Offline Web browser
#aptitude install httrack
#httrack

32. Rename USB/External Hard drive
#aptitude install mtools
Connect USB drive, then
Check device...
#fdisk -l
#umount /media/label_name
#mlabel -i /dev/device_name ::New_name(Without space)


If you get a message like:
"Total number of sectors (7831520) not a multiple of sectors per track (63)!"
You can easily ignore the check by running this command:
#echo mtools_skip_check=1 >> ~/.mtoolsrc

33. Reset root passwd(LIVE)
#mkdir /media/name
#fdisk -l(check ext3)
#mount /dev/device name /media/name
#chroot /media/name /bin/bash
#passwd root
#new_unix_passwd
#umount /media/name
#reboot

34. Killing process:
a) #killall firefox-bin (if firefox gets hang)
b) #ps ux (Select the player and see PID number)
    #kill -9 (PID number)
c) #killall soffice.bin (if office gets hang)
d)#xkill (if player gets hang)

35. LAN network icon interface
   # vim /etc/NetworkManager/nm-system-settings.conf
(change the “managed=false” to “managed=true” and then save it)
  #killall nm-system-settings (optional)

36. Wireless icon interface
   #Run "nm-applet --sm-disable" without quote in Run Application by pressing left Alt+F2

37. Configuring Time & Date with %p for AM & PM
# date +%T%p -s "6:10:30AM"
# date +%T%p -s "12:10:30PM"
# date -s "2 OCT 2006 18:00:00"

38. Package install:
 #dpkg -i (package)

39. If printer doesn't work (lack of driver), install:
   #aptitude install hplip-cups

40. Permanent mount of FAT32 filesystem:
    #fdisk -l (in root)
    #mkdir /media/filename
    #mount -t vfat /dev/? /media/filename
    #vim /etc/fstab (add rw,user,noauto in option and restart)

41. To fix broken AVI files
     #aptitude install mencoder (in root)
     #mencoder -idx homemovie.avi -ovc copy -oac copy -o homemovie-repaired.avi