You are not logged in.

#1 2009-03-10 14:55:39

dr/owned
Member
Registered: 2009-01-09
Posts: 136

[Guide] Useful terminal commands for troubleshooting/system status.

Hi everyone.  I'm looking for a concise list of useful commands to run incase something should happen to be going wrong somewhere (and also a 1-line for what they do)...the kind of output you'd post in a bug report.  Some other good commands would help make "whats going on under the hood" more clear.

Also, if you have some useful directories (like /var/log), I'll take them too.


Current List (Thanks to all the posts below):

iwconfig, ifconfig | currently running wireless and overall link/state status.
dmesg | down/n/dirty low level system activity log
htop (non-built-in) | Process monitor
iftop, nethogs (non-built-in) | Bandwidth usage monitor
lsmod | Currently loaded modules
pstree | Currently running processes in a tree-text format
df -h | Hard drive space usage
ps -A -ao rss,comm | sort -rn | sed -n '1,5{s/^/\t/;s/ /\t/p}' | Top 5 ram hogs and how much
xsel -o -p |  Clipboard monitoring (non-built-in)
xsel -o -b |

/var/log - looking for a log from a system process...probably here.
~/.XXXX - User installed programs house their config files here... ~/ = Your username's home directory.  Equivalent to Application Data on Windows.

Last edited by dr/owned (2009-03-21 15:57:21)

Offline

#2 2009-03-10 15:03:52

Ranguvar
Member
Registered: 2008-08-12
Posts: 2,544

Re: [Guide] Useful terminal commands for troubleshooting/system status.

dmesg gives the boot log. A quick look through it can reveal subtle mis-configurations, etc.

iwconfig gives wireless info, obviously. iwlist scan gives nearby networks.

Pretty much everything in /var/log/ can be very useful.

Offline

#3 2009-03-10 15:22:46

dr/owned
Member
Registered: 2009-01-09
Posts: 136

Re: [Guide] Useful terminal commands for troubleshooting/system status.

Any other useful commands to know for general "whats going on under the hood"?

Offline

#4 2009-03-10 15:25:30

bangkok_manouel
Member
From: indicates a starting point
Registered: 2005-02-07
Posts: 1,556

Re: [Guide] Useful terminal commands for troubleshooting/system status.

most apps will have a verbose option

Offline

#5 2009-03-10 22:15:38

Daenyth
Forum Fellow
From: Boston, MA
Registered: 2008-02-24
Posts: 1,244

Re: [Guide] Useful terminal commands for troubleshooting/system status.

dmesg, iwconfig, ifconfig, iftop, htop, nethogs are all useful. /var/log.

I use this for a quick overview of my tcp+udp connections

#!/bin/bash

netstat -tpun |\
sed '1 d' |\
sort -t/ +1 |\
fgrep -v 'TIME_WAIT' |\
fgrep -v 'FIN_WAIT' |\
fgrep -v 'CLOSING' |\
fgrep -v 'LAST_ACK' |\
fgrep -v '127.0.0.1'

Last edited by Daenyth (2009-03-10 22:16:39)

Offline

#6 2009-03-10 23:44:38

dr/owned
Member
Registered: 2009-01-09
Posts: 136

Re: [Guide] Useful terminal commands for troubleshooting/system status.

Thanks Daenyth, iftop,htop,and nethogs aren't "default" Arch commands but now I know some more utilities I need to install.

Anything else...like if someone in a bug report were to say "this isn't working"...the most common response would be "post the output of [...]"...anymore [...]'s out there?

Edit: Woot, I found another one: lsmod - displays the currently loaded modules (useful for finding wasteful ones that should be blacklisted).

Last edited by dr/owned (2009-03-10 23:48:54)

Offline

#7 2009-03-10 23:55:25

Procyon
Member
Registered: 2008-05-07
Posts: 1,819

Re: [Guide] Useful terminal commands for troubleshooting/system status.

strace command <-- for seeing what goes wrong

And these are all the commands that I want to see at all times on my computer:
pstree <-- processes in tree-view with concise threads display
ps -A -ao rss,comm | sort -rn | sed -n '1,5{s/^/\t/;s/ /\t/p}' <-- top 5 memory users (RSS=what this process really uses in RAM)
df -h <-- hard drive status
xsel -o -p
xsel -o -b <-- see what is in the clipboards

Offline

#8 2009-03-11 00:01:12

dr/owned
Member
Registered: 2009-01-09
Posts: 136

Re: [Guide] Useful terminal commands for troubleshooting/system status.

pstree is a really awesome one.

I laugh at ones like this: ps -A -ao rss,comm | sort -rn | sed -n '1,5{s/^/\t/;s/ /\t/p}' because I couldn't have come up with that or understand why it works in a million years smile

Offline

#9 2009-03-17 00:36:52

Daenyth
Forum Fellow
From: Boston, MA
Registered: 2008-02-24
Posts: 1,244

Re: [Guide] Useful terminal commands for troubleshooting/system status.

htop has a tree mode built in. tongue

One tool that I just found this week is "mtr"; a combination of ping and traceroute in one command.. it's VERY cool.

Getting to know the /proc pseudo-filesystem is handy. Learn about the entries in /proc/$PID/, /proc/cpuinfo, /proc/partitions at least

Last edited by Daenyth (2009-03-17 00:45:40)

Offline

#10 2009-03-21 15:52:58

dr/owned
Member
Registered: 2009-01-09
Posts: 136

Re: [Guide] Useful terminal commands for troubleshooting/system status.

uname -r or -a | displays kernel/distro version

found a few more over here http://www.howtogeek.com/tag/linux/.  I'm back in XP right now so I'll update my first post after I get home in a few days and test everything in Arch smile

Last edited by dr/owned (2009-03-21 15:54:16)

Offline

#11 2009-03-21 17:06:43

Gen2ly
Member
From: Sevierville, TN
Registered: 2009-03-06
Posts: 1,529
Website

Re: [Guide] Useful terminal commands for troubleshooting/system status.

iotop is Definitely a good tool to check on whats taking hard drive resources.


Setting Up a Scripting Environment | Proud donor to wikipedia - link

Offline

#12 2009-03-21 22:13:59

briest
Member
From: Katowice, PL
Registered: 2006-05-04
Posts: 468

Re: [Guide] Useful terminal commands for troubleshooting/system status.

ltrace -- strace-like, but shows library calls, not only system ones.
vmstat -- shows many essential system parameters at a glance, first tool to start investigating bottlenecks
lsof -- "list open files"; as network sockets, pipes, ... are all "files", there are many interesting informations to gather. But I use it for two purposes mainly: to identify file descriptors in strace/ltrace output and for finding deleted, but still open files eating disk space.

I like atop also, for its ability to show aggregated data, grouped by user or process name.

Offline

#13 2009-03-22 00:03:37

test1000
Member
Registered: 2005-04-03
Posts: 834

Re: [Guide] Useful terminal commands for troubleshooting/system status.

never leave home without it tongue(youre supposed to run this before you expect something to fail obviously..) -- sudo tail -f /var/log/* (because i have no frickin idea what prog prints to what log file)

there's also something called inotail(inotify tail) but i haven't tried it.

Last edited by test1000 (2009-03-22 00:17:15)


KISS = "It can scarcely be denied that the supreme goal of all theory is to make the irreducible basic elements as simple and as few as possible without having to surrender the adequate representation of a single datum of experience." - Albert Einstein

Offline

#14 2009-03-23 14:34:14

dr/owned
Member
Registered: 2009-01-09
Posts: 136

Re: [Guide] Useful terminal commands for troubleshooting/system status.

I just recalled lspci -nnvv from ubuntu.  Need to make sure it's valid out of the box in arch cause it sure gives useful hardware info.

Offline

#15 2009-03-23 14:37:20

Daenyth
Forum Fellow
From: Boston, MA
Registered: 2008-02-24
Posts: 1,244

Re: [Guide] Useful terminal commands for troubleshooting/system status.

GNU screen needs a mention. Anyone using the cli more than trivially needs it.

Offline

#16 2009-03-23 15:27:46

Ranguvar
Member
Registered: 2008-08-12
Posts: 2,544

Re: [Guide] Useful terminal commands for troubleshooting/system status.

...unless they're using dvtm and/or tmux smile

Offline

#17 2009-03-23 18:17:37

Cyrusm
Member
From: Bozeman, MT
Registered: 2007-11-15
Posts: 1,053

Re: [Guide] Useful terminal commands for troubleshooting/system status.

just a thought, I have the output of my /var/log/messages.log on my desktop using conky (great for troubleshooting and monitoring networking and volume mounting, just make sure your user is a member of the log group) , and much of the other information on another conky (Hard drive info, ram usage, ram hogs, cpu info etc.)
with this set up I have loads of useful information at a glance, updated in real time, right on my desktop.


Hofstadter's Law:
           It always takes longer than you expect, even when you take into account Hofstadter's Law.

Offline

#18 2009-03-25 12:58:08

dr/owned
Member
Registered: 2009-01-09
Posts: 136

Re: [Guide] Useful terminal commands for troubleshooting/system status.

Someone posted output from top and iotop was also suggested.  Haven't had time to fiddle with Arch recently though.

Offline

#19 2009-03-25 19:36:07

Xiong Chiamiov
Member
From: central coast, california
Registered: 2008-06-18
Posts: 142
Website

Re: [Guide] Useful terminal commands for troubleshooting/system status.

dr/owned wrote:

htop (non-built-in) | Process monitor

You should add plain old top to that line, since it's installed by default.

Offline

#20 2009-03-25 23:23:20

dr/owned
Member
Registered: 2009-01-09
Posts: 136

Re: [Guide] Useful terminal commands for troubleshooting/system status.

fdisk -l -- partition/hdd setup info

Offline

Board footer

Powered by FluxBB