Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 02-11-2009, 02:45 PM   #1
Registered: Dec 2006
Posts: 112

Rep: Reputation: 16
Helpful Linux commands

Hi All,

Whenever I learn a new command, I always write it down so I won't forget it. I was going through my growing commands doc to prune it down a bit and thought my list might be helpful for people new to linux. Many of the commands most people know but some may be new to you. Please feel free to reply with some gems that you find especially helpful. Cheers and happy computing!



alien -iv: [package name] alien converts .rpm to .deb

du -ch: /path/to/folder check file or directory size in total
amount and in human-readable terms.

dpkg-reconfigure fontconfig-config: font quality check

grub-install:*install grub on your drive*

dmesg | more: shows boot-up messages

module-assistant:*module-assistant is the command-line tool for
handling module-source packages that have been prepared for the Debian distribution. It helps users to build and install module package(s) easily for one or more custom kernels.

lsmod: lists loaded kernel modules

lspci: lists info on hardware lshw lists more detail and apt-get install hwinfo for another good tool. mkxf86config for monitor capabilities

umask: set in env.vars. (.bashrc?). Decide what your default environmental file permissions should be for thinks such as touch and text editors. Ex. U: 7 G: 5 O:0. Subtract this number from 777 and the result (027), is your umask

whatis: microscopic man page. Form: whatis mkdir

cmp: create a file, modify it and save it as a different file. use cmp to compare the differences between the two files

df -Th: report file system disk space usage
more /proc/cpuinfo: shows info on the cpu

ddcprobe: monitor info

modprobe “device” **modprobe intelligently adds or removes a module from the Linux kernel: note that for convenience, there is no difference between _ and - in module names
update-alternatives --config (item) check in /etc/alternatives for list.

alsamixer: sound input/output config gdebi

checkinstall: (run in the root directory of a package source tree). checkinstall -D turns most source into a .deb (use dpkg -i to install). The -R option turns it into a .rpm package

tar jxvf: unpacks .tar .bz package in one fell swoop

dpkg -l package* | grep -i ^ii example, lists actual package name so it can be removed (in this case by dpkg)

uname -a finds kernel version

readlink: display value of a symbolic link. The following example shows which driver module controls the eth0 device:

readlink /sys/class/net/eth1/device/driver/module

cat /proc/cpuinfo: *cpu info

apt-get moo: *just kinda fun

ifconfig [interface]*up/down: brings specified nic on or off line

top: shows real-time cpu usage by process. -U username for specific user

apropos: info on man pages- very cool*

stat [filename]: verbose info on files

dpkg --list: shows all dpkg installed packages

df -h or better yet fdisk -l:*List hard drive info/names

ctrl-alt-backspace: kills xserver

runlevel: shows current runlevel

telinit x: change runlevel

sysv-rc-conf: start/stop specifications for init scripts by runlevel. You can also go to the /etc/runlevel and replace the “S” with a “K”

update-grub: updates grub boot menu

gcc --version: gnu compiler version

tzselect:* sets timezone

pmount: ("policy mount") is a wrapper around the standard mount program which permits normal users to mount removable devices without a matching /etc/fstab entry

pstree [process]:*display a tree of processes

dhclient: requests and renews dhcp address from dhcp server

Last edited by parent's_basement; 02-11-2009 at 04:06 PM.
Old 02-11-2009, 02:55 PM   #2
LQ Guru
Registered: Dec 2005
Location: Somewhere on the String
Distribution: Debian Wheezy (x86)
Posts: 6,094

Rep: Reputation: 273Reputation: 273Reputation: 273
A few more you may want to add:

lsusb -- list usb devices
lshw -- list more detailed hardware information of your system including chipsets, motherboard manufacturer, RAM details, etc (I had to install this separately from the Debian repos)
Old 02-11-2009, 04:08 PM   #3
Registered: Dec 2006
Posts: 112

Original Poster
Rep: Reputation: 16
Thanks for the additions pljvaldez!

Old 02-11-2009, 04:10 PM   #4
Registered: Jan 2009
Distribution: Desktop- Debian 4.0
Posts: 43

Rep: Reputation: 16
Hello parent's_basement, you have some really good commands in that list!

lsb_release -a
#OS and distribution information.
dmesg|grep WORD
#Boot messages piped, where “WORD” is the search subject.
cat /var/log/Xorg.0.log|grep EE
#list errors for the X Window System.
TuxFiles: The Basics: Linux Command Line.
Old 02-11-2009, 05:16 PM   #5
Senior Member
Registered: Dec 2007
Location: Croatia
Distribution: Debian GNU/Linux
Posts: 1,733
Blog Entries: 5

Rep: Reputation: 127Reputation: 127
Ohh,you must have my favorite in that list...
find / -name stupid -exec /bin/rm -f '{}' \;
- Remove all stupid files in the system.

UPDATE:just to make things clear if they are not to somebody;if you replace word stupid with for example word john,command will delete all files named john in the system.
Here are few more;
ls -l | grep Aug | wc -l
- prints the number of files in the current directory modified in August.
tail -f /var/log/mail.log
- Prints the last few lines of a file and then waits, printing new lines as they are appended to the file. This is great for watching a log file.
find ~ -name '*.txt' -print
- Look under your home directory for any txt files.
gpg -c file
- Encrypt file.
netstat -tup
- List active connections to/from the system.

Last edited by alan_ri; 02-12-2009 at 12:55 PM. Reason: UPDATE
Old 02-11-2009, 05:46 PM   #6
Registered: Aug 2008
Distribution: Slackware
Posts: 53

Rep: Reputation: 16
$cal - calendar
$ls /mnt/cdrom > file_listing - cd/dvd file listing on your hdd. Call it dvd_1 and label the corrspondent dvd with pencil dvd_1 too. To find file in this list use $grep lost_file dvd_1 , or if you are in directory with several file lists $grep lost_file * . Now finding files is easier among those hundreds of discs.

Last edited by Reasa; 02-11-2009 at 05:50 PM.
Old 02-11-2009, 07:21 PM   #7
Registered: Oct 2008
Location: Middle TN
Posts: 134

Rep: Reputation: 19
Here's a couple more that I like to employ:


As su[do], with the addition of '-n or -i', it will either reboot or halt the system. When getting attacked ferociously by hacks and what not, a quick press of Alt+F2, and run one of those in terminal, really helps prevent contamination of settings and config scripts.

The '-n' option tells the sys. there's to be no syncing, and the '-i' shuts down the interface for the network.
Old 02-11-2009, 08:25 PM   #8
Registered: Dec 2006
Posts: 112

Original Poster
Rep: Reputation: 16

Thanks! Also try these:

init 0 (halts the os)

init 6 (reboots the os)


Last edited by parent's_basement; 02-11-2009 at 08:27 PM.
Old 02-12-2009, 12:17 PM   #9
Registered: May 2005
Location: Berkeley, CA.
Distribution: debain freebsd
Posts: 483

Rep: Reputation: 31
Good to see a growing list. This is very helpful.



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Anywhere to go for helpful commands? MooCows Linux - Newbie 7 12-30-2004 05:33 PM
WLAN + Linux Virgin - Need Helpful Advice! ArthurDent Linux - Wireless Networking 18 03-26-2004 11:50 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:34 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration