View Single Post
Old 10-16-2003, 10:20 AM   #25
healtheworld
Member (7 bit)
 
Join Date: Mar 2003
Posts: 87
How to find out things in Linux with bash commands
Don't forget that re-direction and piping add to the power in bash, so some of these tips use them.

# Basic piping
some_command | another_command
See Linux and the tools philosophy
# Basic re-direction:
command > textfile_name
See this Text Manipulation Article
# Basic concantenation:
If you don't want to overwrite a file but add to the bottom of an existing file, concantenate it:
command >> exisiting_text_file

The bash commands:
# Find CPU specifications
cat /proc/cpuinfo

# What pci cards are installed and what irq/port is used
cat /proc/pci

# Memory information
free

# How is the hard drive partitioned
fdisk /dev/hdXX -l

# How much free drive space
df -h

# Show disk usage by current directory and all subdirectories
du | less

# Find running kernel version
uname -r

# Find X server version
X -showconfig

# What is the distribution
cat /etc/.product
cat /etc/.issue
cat /etc/issue
cat /etc/issue.net
sysinfo

# For finding or locating files
find
locate
which
whereis

# Use dmesg to view the kernel ring buffer (error messages)
dmesg | less

# Watch error messages as they happen (sysklog needed)
as root, tail -f /var/log/messages (shows last 10 lines, use a number in front of f for more lines)

# What processes are running
ps -A

# Find a process by name
ps -ef | grep -i
For example, XCDroast
ps -ef | grep -i xcdroast /* Case Insensitive */

# See current environment list, or pipe to file
env | more
env > environmentvariablelist.txt

# Show current userid and assigned groups
id

# See all command aliases for the current user
alias

# See rpms installed on current system
rpmquery --all | more
rpmquery --all > .txt
rpmquery --all | grep -i /* find specific rpms with name in them */ <br /> <br /> # What directory am I using <br /> pwd <br /> <br /> Look at man <command> or info <command> for the flags and options you can use for bash commands </div> <!--INFOLINKS_OFF--> <!-- / message --> </td> </tr> <tr> <td class="alt2" style="border: 1px solid #D1D1E1; border-top: 0px"> <img class="inlineimg" src="images/statusicon/user_offline.gif" alt="healtheworld is offline" border="0" /> &nbsp; </td> <td class="alt1" align="right" style="border: 1px solid #D1D1E1; border-left: 0px; border-top: 0px"> <!-- controls --> <a href="http://www.pcmech.com/forum/newreply.php?do=newreply&amp;p=546250" rel="nofollow"><img src="images/buttons/quote.gif" alt="Reply With Quote" border="0" /></a> <!-- / controls --> </td> </tr> </table> <!-- post 546250 popup menu --> <div class="vbmenu_popup" id="postmenu_546250_menu" style="display:none"> <table cellpadding="4" cellspacing="1" border="0"> <tr> <td class="thead">healtheworld</td> </tr> <tr><td class="vbmenu_option"><a href="http://www.pcmech.com/forum/members/healtheworld.html">View Public Profile</a></td></tr> <tr><td class="vbmenu_option"><a href="http://www.pcmech.com/forum/search.php?do=finduser&amp;u=15660" rel="nofollow">Find More Posts by healtheworld</a></td></tr> </table> </div> <!-- / post 546250 popup menu --> <!-- / post #546250 --> <table class="tborder" cellpadding="6" cellspacing="1" border="0" width="100%" style="border-top-width:0px"> <tr> <td class="tfoot" align="center"> <input type="button" class="button" value="Close this window" id="close_button" style="display: none;" /> &nbsp; <script type="text/javascript"> <!-- if (self.opener) { var close_button = fetch_object('close_button'); close_button.style.display = ''; close_button.onclick = function() { self.close(); }; } //--> </script> </td> </tr> </table> </form> <script type="text/javascript"> <!-- // Main vBulletin Javascript Initialization vBulletin_init(); //--> </script> </body> </html>