LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 06-10-2003, 05:14 AM   #1
jmcmillan
LQ Newbie
 
Registered: Jun 2003
Posts: 13

Rep: Reputation: 0
Talking Linux commands - simple for some


Hello all,
Linux newbie that I am, I would like know if anyone can tell me of a few commands.

1) an rpm command which lists all installed packages
(similar to pkginfo -l on Solaris)
*** I'd use the man pages but for some reason they're screwy ***

2) a command similar to 'find' on Solaris, something that
would allow me to recursively search from a specified directory
for specified strings of text or files modified/created in the last
n days.

3) I'd also invite anyone who reads this to post one common
command they think may be useful, anything to do with monitoring
processor usage, memory allocation, disk usage.
any little tips and tricks gratefully received.

All the best

Johnm

Last edited by jmcmillan; 06-10-2003 at 05:16 AM.
 
Old 06-10-2003, 05:22 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
1) rpm -qa

2) find

3) ok.
 
Old 06-10-2003, 08:06 AM   #3
fancypiper
LQ Guru
 
Registered: Feb 2003
Location: Sparta, NC USA
Distribution: Ubuntu 10.04
Posts: 5,141

Rep: Reputation: 58
# 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

Handy bash commands for finding out stuff in Linux:
# Find CPU specifications
cat /proc/cpuinfo

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

# Memory and swap information
free
An article: Tips for Optimizing Linux Memory

# How is the hard drive partitioned
fdisk /dev/hd<X> -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 compiler version do I have
gcc --version

# 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 <plain text>
For example, XCDroast
ps -ef xcdroast

# 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 > <filename>
rpmquery --all | grep -i <plaintext>

# What directory am I using
pwd

# What takes up so much space on your box
# Run from the directory in question and the largest chunk shows up last
find $1 -type d | xargs du -sm | sort -g

Look at man <command> or info <command> for the flags I used and for other options you can use for bash commands.
 
Old 06-10-2003, 09:51 AM   #4
rsingh
Member
 
Registered: May 2003
Posts: 44

Rep: Reputation: 15
the command 'ps -e -o pid,ppid,command ' shows all the processes running on the system,their parent pid,their own pid and the command which invoked them.read ps man page.

also do "skill -9 <process>" to kill any unresponding process just like you use task manager in windows.

actually there is a graphical interface similar to task manager .go to system tools on main menu and then to system monitor it shows all processes and their cpu usage in redhat 9 with gnome
 
Old 06-10-2003, 02:14 PM   #5
MArgRes
Member
 
Registered: Jun 2003
Distribution: Fedora Core 2
Posts: 37

Rep: Reputation: 15
In Redhat, you can grep for a specific package in the log file /var/log/rpmpkgs, which holds a list of all of the packages you have installed. Pretty much the same thing as 'rpm -qa | grep <package-name>' I think, except it's much faster because it doesn't have to query the rpm database.

One of the most useful rpm commands in my experience is for when you have a file and you want to know what package (if any) it belongs to. In that case you can type 'rpm -qf <file-name>' and it will return the package that the file belongs to. Another useful rpm command is 'rpm -qi <package-name>' which will tell you about that package.

Some others:

rpm -qc <package-name> lists any configuration files for that package.
rpm -qd <package-name> lists any documentation for that package.

One important thing: if you want to do any of the above queries on a package that hasn't been installed yet, (i.e. it's on the cd or you downloaded it), you have to put a 'p' (for 'package') in the flag list: rpm -qpi <package-name>; otherwise, rpm will just complain that '<package-name>' isn't installed.


As far as other useful "monitoring" commands go, 'top' is a good command to know. It's like 'ps' but runs continuously so you can see what's happening on your system in real time. For example, 'top -ic' will continuously print out the current processes that aren't idle and will show you the command that ran them.

Another useful command is 'file <file-name>' which will try to tell you what type of file <file-name> is, (such as a binary file, a zipped file, etc.).
 
  


Reply


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
Automating simple commands, scripting or programming? entob *BSD 3 09-01-2004 01:56 AM
simple search commands in linux t3___ Linux - Newbie 6 06-08-2004 01:16 PM
Simple Commands jackel Linux - Newbie 3 04-13-2004 11:43 PM
Is there a simple way to launch commands on other machines? BrianK Linux - Networking 3 01-04-2004 04:30 PM
Linux commands mikkythomeon Linux - Newbie 3 02-19-2003 05:00 AM


All times are GMT -5. The time now is 06:09 AM.

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