Jump to content

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


Recommended Posts

I wanted to create a thread for the obscure tools in Mandrake Linux and maybe Linux in general that would've definitely been a help to me if I had known about them as a newbie. It may have helped me avoid asking questions here. Feel free to add things that you consider obscure useful tools/commands, but remember this is a 'Tips' thread and not a question thread...if you want clarification, please Search first, then ask in the appropriate Forum and link here to show what you are inquiring about. If I'm wrong about something, feel free to correct me here also.

Even though I've gotten some experience over the last year or so and can answer questions here, there's still plenty I'm totally clueless about.

 

Here's the first few things I've discovered very recently:

 

modinfo: Don't know what options can be passed to a certain module when loading it or putting in /etc/modules.conf? Use modinfo. Alot of times, you'll find options you didn't know the module had.

 

Ex:

[root@localhost omar]# modinfo es1371

filename:    /lib/modules/2.4.20/kernel/drivers/sound/es1371.o

description: "ES1371 AudioPCI97 Driver"

author:      "Thomas M. Sailer, sailer@ife.ee.ethz.ch, hb9jnx@hb9w.che.eu"

parm:        joystick int array (min = 1, max = 5), description "sets address and enables joystick interface (still need separate driver)"

parm:        spdif int array (min = 1, max = 5), description "if 1 the output is in S/PDIF digital mode"

parm:        nomix int array (min = 1, max = 5), description "if 1 no analog audio is mixed to the digital output"

parm:        amplifier int, description "Set to 1 if the machine needs the amp control enabling (many laptops)"

 

 

urpmf, rpm --verify and rpm -i --replacepkgs: Some of your programs not running right? Getting compilation errors for files not found from packages that you know are installed?

 

Totally fictitious ex (don't try this on your machine and expect any results...LOL):

 

make **Error 1: Cannot find libstupid.so.1**

# locate libstupid.so.1

# urpmf libstupid.so.1

Stupid: /usr/lib/libstupid.so.1

# rpm -qa | grep Stupid

Stupid-2.0.1-mdk

# rpm --verify Stupid-2.0.1-mdk

missing    /usr/lib/libstupid.so.1

# rpm -i --replacepkgs Stupid-2.0.1-mdk

############################################### [100%]

# slocate -c -u

# locate libstupid

/usr/lib/libstupid.so.1

 

Stolen from aru:

Additionally, you can check to see what files are missing from all installed packages by doing this:

rpm -Va --nodeps --nomd5 --noscripts | grep missing | grep -v "/dev/" | tee missing_files.list

and then what packages those missing files belong to by:

rpm -qf $(awk '{print $NF}' missing_files.list) | uniq

 

 

Thanks to all those who write tutorials and post them on the web and for those who actually post everything they've tried to accomplish things. I wouldn't learn some of these obscure things without them. There are too many to mention and I've forgotten where I've stolen alot of ideas.

 

More to Come...

Link to comment
Share on other sites

  • Replies 36
  • Created
  • Last Reply

Top Posters In This Topic

What I found in helping to find these "hidden treasures" is the info command in a terminal. Just browse through it. Also, Everyone knows about man pages but have you ever opened a filemgr and looked at what's there? Interesting stuff......

Link to comment
Share on other sites

Guest fubar::chi

Well I consider myself a pro at making fubar systems so I've come across a few tricks to help me restore mdk to it's former glory without a reinstall.

Let's say you've messed with you kernel (remove the working entry and replace with a new one) and it doesn't work. You boot to fix the prob, and you don't have a boot disk because you don't have floppy drive. Enter the mandrake install CD1 and chroot

You can enter a rescue environment cd to you root drive which will be somewhere in mount and then chroot. Now you can edit lilo.conf files in read write mode and all that good stuff. Of course if I was using grub or at least had a boot disk i wouldn't have that prob. eh

 

ifconfig also comes in handy. I managed to screw up my net connection once so that the settings configured wouldn't work. ifconfig saved my arse

syntax::

ifconfig eth0 ip_address netmask netmask_address

and also the route command saved my @$$. Both tricks (chrooting and manual internet config) I picked up from the gentoo installation experience. More (accurate) info is here

http://www.gentoo.org/doc/en/gentoo-x86-in...l.xml#doc_chap4

http://www.gentoo.org/doc/en/gentoo-x86-in...l.xml#doc_chap8

Link to comment
Share on other sites

xman is your friend. While not exactly something to be done in a shell, xman is an easy way to browse the manpages. Before it'll run, you need to export the path of your manpages:

[root@localhost man]# export MANPATH=/usr/share/man/:$MANPATH

 

You can add that to your ~/.bash_profile so that it is available each time you open a shell emulator.

Link to comment
Share on other sites

Guest fubar::chi

or if you use konqueror you can type man:manpage and it'll show up a nice scrollable, searchable page (works for info too!)

Link to comment
Share on other sites

I decided to rename this topic from "I Didn't Know You Could Do That in a Shell..." to "I Didn't Know You Could Do That in Linux...", since I'm going to include stuff that you don't have to do in a shell (terminal, console, whatever you wanna call it).

 

Here's something new I learned. I've been to Mandrake Control Center (mcc) manymany times and never noticed the System > Fonts option and that down at the bottom, you can add fonts (if you have a dual boot, it will even find and install your Windows fonts). You can also call it from a shell with 'drakfont' (without the quotes). All this time I never noticed it. LOL.

Link to comment
Share on other sites

  • 2 weeks later...
Guest xaff

I think that "ls -l" is a really usefull command for displaying files and their access permissions.

 

(I'll add example code later on.)

 

[root@localhost wget-1.8]# ls -l

total 960

-rw-r--r--    1 9151     users      119747 Jun 14  2001 aclocal.m4

-rw-r--r--    1 9151     users         689 Dec  5  2000 AUTHORS

-rw-r--r--    1 9151     users       26055 Dec  8  2001 ChangeLog

drwxr-xr-x    2 9151     users        4096 Dec  8  2001 ChangeLog-branches/

-rw-r--r--    1 9151     users        1834 Mar  1  2001 ChangeLog.README

-rw-r--r--    1 root     root         5707 May 27 20:21 config.cache

-rwxr-xr-x    1 9151     users       39311 Jun 14  2001 config.guess*

-rw-r--r--    1 root     root        13758 May 27 20:21 config.log

-rwxr-xr-x    1 root     root        21080 May 27 20:21 config.status*

-rwxr-xr-x    1 9151     users       27594 Jun 14  2001 config.sub*

-rwxr-xr-x    1 9151     users      243515 Dec  8  2001 configure*

-rw-r--r--    1 9151     users        1574 Dec  2  1999 configure.bat

-rw-r--r--    1 9151     users       11379 Dec  6  2001 configure.in

-rw-r--r--    1 9151     users       17976 Dec  2  1999 COPYING

drwxr-xr-x    3 9151     users        4096 May 27 20:21 doc/

-rw-r--r--    1 9151     users        3572 May 26  2001 INSTALL

-rwxr-xr-x    1 9151     users        5585 Dec  2  1999 install-sh*

-rwxr-xr-x    1 root     root       146905 May 27 20:21 libtool*

-rw-r--r--    1 9151     users      138312 Jun 14  2001 ltmain.sh

-rw-r--r--    1 9151     users         848 Jun 16  2001 MACHINES

-rw-r--r--    1 9151     users         989 Apr 27  2001 MAILING-LIST

-rw-r--r--    1 root     root         4392 May 27 20:21 Makefile

-rw-r--r--    1 9151     users        1366 Dec  9  2000 Makefile.cvs

-rw-r--r--    1 9151     users        4390 Mar 27  2001 Makefile.in

-rwxr-xr-x    1 9151     users         732 Dec  2  1999 mkinstalldirs*

-rw-r--r--    1 9151     users       13660 Dec  1  2001 NEWS

-rw-r--r--    1 9151     users        5350 Apr 27  2001 PATCHES

drwxr-xr-x    2 9151     users        4096 May 27 20:21 po/

-rw-r--r--    1 9151     users        3490 Dec  7  2001 README

-rw-r--r--    1 9151     users        1182 Jan  6  2001 README.cvs

drwxr-xr-x    3 9151     users        4096 May 27 20:21 src/

-rw-r--r--    1 root     root           10 May 27 20:21 stamp-h

-rw-r--r--    1 9151     users          10 Dec  2  1999 stamp-h.in

-rw-r--r--    1 9151     users        5273 Dec  1  2001 TODO

drwxr-xr-x    2 9151     users        4096 May 27 20:21 util/

drwxr-xr-x    2 9151     users        4096 May 27 20:21 windows/

[root@localhost wget-1.8]#

Link to comment
Share on other sites

I think that "ls -l" is a really usefull command for displaying files and their access permissions.

 

(I'll add example code later on.)

 

If you liked that, you are going to love this one:

 

~$ stat -c '%-25n (permissions %a) size:%10s bytes' *

Makefile                  (permissions 664) size:       377 bytes

daemonnews                (permissions 664) size:       304 bytes

daemonnews199901.tar.gz   (permissions 664) size:    412688 bytes

daemonnews199902.tar.gz   (permissions 644) size:    461319 bytes

daemonnews199903.tar.gz   (permissions 644) size:    521127 bytes

daemonnews199904.tar.gz   (permissions 644) size:    468438 bytes

daemonnews199905.tar.gz   (permissions 644) size:    483363 bytes

 

another example:

~$ stat -c '%-23n is a %F, which was created on %y by %U' *

Makefile                is a Regular File, which was created on 2003-05-27 17:35:04.000000000 -0400 by aru

daemonnews              is a Regular File, which was created on 2003-05-27 17:01:58.000000000 -0400 by aru

daemonnews199901.tar.gz is a Regular File, which was created on 1999-01-04 00:30:25.000000000 -0500 by aru

daemonnews199902.tar.gz is a Regular File, which was created on 1999-02-05 20:40:01.000000000 -0500 by aru

daemonnews199903.tar.gz is a Regular File, which was created on 1999-03-02 19:06:16.000000000 -0500 by aru

daemonnews199904.tar.gz is a Regular File, which was created on 1999-04-20 19:01:11.000000000 -0400 by aru

daemonnews199905.tar.gz is a Regular File, which was created on 1999-05-04 11:46:34.000000000 -0400 by aru

 

Linux is soo cool :cool:

 

(man stat)

Link to comment
Share on other sites

Guest smoketoomuch

I love these kind of threads :D :D :D

 

I've been using linux since last year summer, but it's been only in the past few weeks (a month or so) that I began learning the command line. One interesting command I found to be useful is top, which lists your running processes (like ps) but can do more. It shows uptime, memory usage, load averega, cpu usage, whatever. Its also interactive. For instance, by pressing r while top is running you can renice running processess (i.e. give them I higher or lower nice number: lower means it will be less nice to other processes, in other words it will have more cpu cycles and memory allocated to it). There are many more, of course. Read man top.

 

You can, of course kill processes with top. Just press k and it will ask for the PID number of the process to kill. You can rearrange the ordering of processes as well. And if you press h, it will give you the options you can use while top is running.

Link to comment
Share on other sites

Guest smoketoomuch

Forgot to add: I saw this tip in Intro Linux guide.

http://tldp.org/LDP/intro-linux/html/index.html

 

Its a very well written introduction to linux and unix, and its newbie friendly. Begins with: what do you need? A computer and a medium containing a linux distribution. lol. And it leads you into the world of linux and unix gently, without you even noticing it. I emphasised and unix for it concentrates on those tools that are available on both platforms. Like Vi for text based for processing.

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...