Jump to content

I Didn't Know You Could Do That in Linux...


Recommended Posts

  • Replies 36
  • Created
  • Last Reply

Top Posters In This Topic

Hey, I followed your instructions and tried lsd but all it did was make my monitor go all strange and start flashing colours and shapes at me.

 

If this wasn't enough it now does the same thing from time to time even when I don't ussue the command ???

 

Whats going on ?

 

Erm sorry if I drifted off topic ....

Link to comment
Share on other sites

Hey, I followed your instructions and tried lsd but all it did was make my monitor go all strange and start flashing colours and shapes at me.

 

If this wasn't enough it now does the same thing from time to time even when I don't ussue the command ???

 

Whats going on ?

:lol: watch out for those Low Sugar Diet stickers there, Gowator ;-)

Link to comment
Share on other sites

Hey, I followed your instructions and tried lsd but all it did was make my monitor go all strange and start flashing colours and shapes at me.

 

If this wasn't enough it now does the same thing from time to time even when I don't ussue the command ???

 

Whats going on ?

 

Erm sorry if I drifted off topic ....

 

Strange... it only lists directories for me. Which version are you using ?

Link to comment
Share on other sites

  • 3 months later...

I was just thinking if I could find a way to list what packages require a certain package that I have installed, so I wrote a little dirty script to check:

#!/bin/sh



TEST=$(rpm -qa --queryformat "%{NAME}n" | grep $1) || echo "No package named $1 is installed"

for name in $TEST

  do

    echo "Installed RPM $name is needed by:"

    rpm -q --whatrequires $name

    echo ""

  done



exit 0

 

You invoke it with what you think the name of the package is, no version number or anything, like this (say you name the script requires and put it in /usr/bin and chmod +x it):

[root@omarserenity omar][root@omarserenity omar]# requires sylpheed

Installed RPM sylpheed-claws-ghostscript_viewer-plugin is needed by:

no package requires sylpheed-claws-ghostscript_viewer-plugin



Installed RPM sylpheed-claws-image_viewer-plugin is needed by:

no package requires sylpheed-claws-image_viewer-plugin



Installed RPM sylpheed-claws-devel is needed by:

no package requires sylpheed-claws-devel



Installed RPM sylpheed-claws-trayicon-plugin is needed by:

no package requires sylpheed-claws-trayicon-plugin



Installed RPM sylpheed-claws-mathml_viewer-plugin is needed by:

no package requires sylpheed-claws-mathml_viewer-plugin



Installed RPM sylpheed-claws-spamassassin-plugin is needed by:

no package requires sylpheed-claws-spamassassin-plugin



Installed RPM sylpheed-claws is needed by:

sylpheed-claws-ghostscript_viewer-plugin-0.9.5claws-4mdk

sylpheed-claws-tools-0.9.5claws-4mdk

sylpheed-claws-devel-0.9.5claws-4mdk

sylpheed-claws-mathml_viewer-plugin-0.9.5claws-4mdk

sylpheed-claws-spamassassin-plugin-0.9.5claws-4mdk

sylpheed-claws-image_viewer-plugin-0.9.5claws-4mdk

sylpheed-claws-trayicon-plugin-0.9.5claws-4mdk



Installed RPM sylpheed-claws-tools is needed by:

no package requires sylpheed-claws-tools



[root@omarserenity omar]# requires blacksabbath

No package named blacksabbath is installed

 

It could use a little tweaking. Like maybe list all the matches and let you pick one to test first. Of course aru is gonna come along and show us an easier, better way to do this.

Link to comment
Share on other sites

  • 2 weeks later...

I've been using Mandrake since mdk8 I think. I've found lots of useful command line programs that I've written into a little book:-

 

lspcidrake

lspci -v [in depth pci device list]

lsmod

ps -ef [dump process list to screen, like 'top' but not continuous]

fuser -v /dev/*

ifconfig -a [same as 'ipconfig' under Windows]

netstat | grep tcp

service -s [show current service status]

apropos net [search man pages, in this case for all commands that include the word net, very useful]

 

Hope there's something there that you can make use of. The 'apropos' one I found to be like finding the Holy Grail :D

Link to comment
Share on other sites

BTW you can use

netstat -t

 

to show tcp connections without having to grep

 

netstat -p

also lists the programs responsible for these connections

 

and

netstat -n

is much faster since it lists IPs numericaly without trying to reverse DNS them

 

netstat -c

will let nestat run forever and just refresh the display every few seconds.

 

I usualy want to keep a count of the number of open connections in front of me so I run

 

watch "netstat -tn | wc -l"

 

cheers,

Alaa

Link to comment
Share on other sites

  • 2 weeks later...

Ok, now i am on:

  • du: "DiskUsage". Say you want to know how large some directory-structures are... this is it.
  • eject/eject -t: To eject/load a cdrom. Defaults to the first one in alphabetical order. Else you add the /dev/hdX.
  • ntop: same as top, but for network-traffic
  • iptraf: The BEST tool i've found to monitor Network with menues in ncurse to select the wanted options
  • grep: to filter output. A simple "cat /etc/services|grep -i http" will show you all ports concerning http.
  • "|" : this tunnels output to another console-tool, like seen above.
  • ps -ax: shows all processes with applicationname and pid, etc...
  • /proc: You want to know everything about your smart machine like "sysinfo"? Here you are. For every information is a file which is readable (e.g. cpuinfo, filesystems, meminfo, modules, etc...)
  • wget: wanna mirror a http/ftp-directory? "wget -r http://some-url.org/dummy/" will fetch all files in the path "/dummy" on "some-url.org" on your harddisk recursively.
  • /dev/zero: wanna some zeros? Just copy this file to the file you want to fill with zeros. Be aware, it never stopps ;-) Nice way to delete a partition definetely. Just count the zeros with a for-loop until you filled all available bytes.
  • /dev/null: this is a file where nothing is happening, it just eats everything. E.g.: "make bzImage >/dev/null" will copy every compiling-output of make to /dev/null, what means the screen keeps clean.
  • route: shows all network-concerned routes/gateways

For what do you need this all? Well, a small example:

 

#!/bin/bash
echo "Progress:"
CPU=`cat /proc/cpuinfo|grep "model name"|cut -d":" -f2`;
MHz=`cat /proc/cpuinfo|grep "MHz"|cut -d":" -f2`;
cmdLine=`cat /proc/cmdline`;
modules=`cat /proc/modules|cut -d " " -f1`;
system=`cat /proc/version`;
echo -n "#"
echo "##############################">/var/log/sysinfo
echo "#### System Informations #####">>/var/log/sysinfo
echo "##############################">>/var/log/sysinfo
echo >>/var/log/sysinfo
echo -n "#"

echo "1. You're system is a $CPU with $MHz MHz.">>/var/log/sysinfo
echo >>/var/log/sysinfo
echo -n "#"

echo "2. You're commandline for boot was '$cmdLine'.">>/var/log/sysinfo
echo >>/var/log/sysinfo
echo -n "#"

echo "3. You're OS is '$system'.">>/var/log/sysinfo
echo >>/var/log/sysinfo
echo >>/var/log/sysinfo
echo -n "#"

echo "Following all loaded modules with their options:">>/var/log/sysinfo
echo -n "#"
for module in $modules; do
   echo "Found Module '$module':">>/var/log/sysinfo
   modinfo $module >>/var/log/sysinfo
   echo >>/var/log/sysinfo
   echo -n "#"
done
echo
echo "finished!"
read -p "For results press a key."
clear
cat /var/log/sysinfo

 

What you'll see is a progress-meter, after that the result. In /var/log/sysinfo is a file with the same contents.

 

To be continued.....

 

:headbang:

Link to comment
Share on other sites

  • 2 months later...
  • 3 weeks later...

lsof - Damn useful for when you are trying to umount a filesystem and it says it is busy. Also useful for determining what resources a specific program uses.

 

ldd - All those times you get a lib error. ldd the file and see what libs it wants. perhaps it has a hard coded path or perhaps it is using the wrong version of the lib on your system.

 

They can have my CLI when they pry it from my cold dead hands.

Link to comment
Share on other sites

  • 8 months later...
  • 2 weeks later...
Guest Hobbletoe

Having been a Solaris administrator for a number of years, I came up with two commands that I use quite frequently.

 

ps2() { ps -ef | grep -i $1 | grep -v grep; }

 

This allows me to find a process without having to type the whole thing out all of the time. Only 'ps2 process'. The other one is ...

 

watch () { while ps -ef | grep -i $1 | grep -v grep > /dev/null

do

sleep 5

done

echo "*** Watch for $1 completed at `date +"%H:%M:%S"`. ***"

}

 

This allows me to kick off a job in the background (say a database import that takes hours), and then I can set a watch for it. 'watch imp &'. When the process is done, it prints out that message for me so that I know that it is done (and when in case I need to know about how long a process took since I might not be looking at the screen when it finishes.

 

I put both of these functions in a script and have it run at the end of /etc/profile. Oh, and if you are wondering why not aliases, we use the Bourne (sh) shell at work that doesn't support aliases.

 

Hobbletoe Clubfoot

Mandrake 10.0 Official

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share


×
×
  • Create New...