Jump to content

  • Log in with Facebook Log in with Twitter Log In with Steam Log In with Google Sign In
  • Create Account

Tutorial info Visit support topic

  • Added on: Sep 03 2012 01:30 AM
  • Views: 482

25 Quick Linux Command Line Tips - Part 2

Here are another several top 25 quick linux command line interface basic commands. Linux CLI tips and tricks that resolves simple issues of daily linux routines and objectives.

Posted by PiNoY on Sep 03 2012 01:30 AM
Following up recent quick linux CLI tip Part 1 here.

26. How to print line numbers of each output line of a text file ?

# cat -n yourfile.txt

27. How to negate a grep result?

# grep -v "null" yourfilename

28. How to list statistics from your network ?

# netstat -s

29. What is the country code for a particular country ?

# grep -i philippines /usr/share/zoneinfo/iso3166.tab

30. How to find out who owns and manages a particular domain ?

# whois google.com

31. How to get the resolved IP of a domain ?

# nslookup google.com
# host google.com
# dig google.com

32. How to say hello and goodbye to your system log file ?

# logger 'Hello and Goodbye'

33. How to list out all your USB current connections ?

# lsusb
# lsusb -v

34. How to list out all your PCI card connections ?

# lspci
# lspci -v

35. How to lock/unlock a bash enabled user shell account ?

# passwd -l useraccount
# passwd -u useraccount
# passwd -S useraccount

36. How to limit and change available shell accounts for user's shell assignment ?

# vi /etc/shells

37. How to change the default values when adding new user accounts ?

# vi /etc/default/useradd

38. How to create default files automatically every time a new user accounts is created ?

# cp /home/pinoy/whateverfile.txt /etc/skel
# useradd -d /home/newuser newuser

39. How to go the easy way to home folder of a particular user if you have multinested virtual home folders?

# cd ~hisusername

40. How to browse and download the whole pages of a particular WWW site in one shot ?

# wget -p --progress=dot http://www.google.com

41. How to safely mark badblocks from another ext2/ext3 linux harddisk ?

# umount /dev/other-harddisk2
# e2fsck -c /dev/other-harddisk2

42. How to create a new ext3 filesytem with bad-block checking from your secondary harddisk?

# mkfs.ext3 -c /dev/other-harddisk2

43. How to compare bzip2 compressed files ?

# bzdiff file1 file2

44. How to detect hardware monitoring chips and load modules related to newly detected chips?

# sensors-detect
>45. How to know if your postfix or sendmail is running ?

# ps axuw | grep sendmail
# ps axuw | grep postfix

46. How to change the default port when spamassassin is launched?

# vi /etc/sysconfig/spamassassin

47. How to disable postfix permanently after reboot ?

# chkconfig --levels 345 postfix off

48. How to know the number of children spawned by apache ?

# ps axuw | grep http | wc -l

49. How to avoid a module from being loaded by kernel during startup and blacklist it permanently?

# vi /etc/modprobe.d/blacklist

50. How to quickly count all your queued mail when you box is really hogging due to spam bruteforce attacks and spam mailer?

# mailq | wc -l

How to smile ?