LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 01-23-2003, 09:47 AM   #61
moses
Senior Member
 
Registered: Sep 2002
Location: Arizona, US, Earth
Distribution: Slackware, (Non-Linux: Solaris 7,8,9; OSX; BeOS)
Posts: 1,152

Rep: Reputation: 50

Quote:
Originally posted by Darin
why not just this:

make dep ; make clean ; make bzImage ; make modules ; make modules_install
Because, if any one of those fail, the others still run. It's not safe.
The ";" tells the shell to just continue, regardless of the exit status
of the previous command, which is dangerous. Say your
"make bzImage" command crashed. The above command would
go on to make modules and then make modules_install, and the
error message from make bzImage would be buried under all the
other messages about making the modules. Maybe make modules
or make modules_install would finish successfully, and you'd think
you had a good kernel, and try to boot with it. Not good.
 
Old 02-14-2003, 01:09 PM   #62
ferreter
Member
 
Registered: Oct 2002
Location: USA, IL
Distribution: Debian/Gentoo/Slack
Posts: 215

Rep: Reputation: 30
Here's a silly one,

In bash you can use curley braces to perform a command on multiple files like so: chmog a-s /usr/bin/{at,cron}
 
Old 02-14-2003, 04:29 PM   #63
fancypiper
LQ Guru
 
Registered: Feb 2003
Location: Sparta, NC USA
Distribution: Ubuntu 10.04
Posts: 5,141

Rep: Reputation: 60
Finding out stuff with bash commands

# 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

# 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 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 | grep -i 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.

Last edited by fancypiper; 02-14-2003 at 04:35 PM.
 
Old 02-14-2003, 04:31 PM   #64
fancypiper
LQ Guru
 
Registered: Feb 2003
Location: Sparta, NC USA
Distribution: Ubuntu 10.04
Posts: 5,141

Rep: Reputation: 60
Command line CD ISO/burning commands

# CD burning info
Is it configured and what is the device? Command this to find out:
cdrecord -scanbus
Adding an IDE CD-Writer to Linux
CD Writing HOWTO
# Burn an ISO to disk
cdrecord -v speed=<burning speed> dev=<your device> /path/to/foo.iso
# Burn from disk to disk
cdrecord -v dev=<your device> speed=<burning speed> -isosize /dev/cdrom
# Generate an ISO from a directory.
mkisofs -Jr -o foo.iso /path/to/directory
mkisofs -vrTJUV "Label" -o foo.iso /path/to/directory
# Generate an ISO from a CD
dd if=/dev/cdrom of=foo.iso
Linux MP3 CD Burning mini-HOWTO
# Convert mp3 to wav with lame
for i in *.mp3; do lame --decode $i `basename $i .mp3`.wav; done
# Burn a CD from wav files
cdrecord -v -audio -pad speed=<burning speed> dev=<your device> /path/to/*.wav
# Erase a CDRW
cdrecord -v dev=<your device> speed=<burning speed> blank=fast

# Mount CD iso images
mount /path/to/foo.iso /mnt/iso/ -t iso9660 -o ro,loop=/dev/loop0

Last edited by fancypiper; 06-13-2003 at 02:18 AM.
 
Old 02-14-2003, 04:46 PM   #65
Allen614
Member
 
Registered: Dec 2002
Location: Plains
Distribution: Slackware 13
Posts: 465

Rep: Reputation: 30
Heh heh,wondered when you'd get around to posting that "cdrecord" bit. I saved it to file and canned all those GUI frontends a while back. Thanks again.
 
Old 02-14-2003, 05:05 PM   #66
fancypiper
LQ Guru
 
Registered: Feb 2003
Location: Sparta, NC USA
Distribution: Ubuntu 10.04
Posts: 5,141

Rep: Reputation: 60
Why can't I delete my own post?

Last edited by fancypiper; 02-14-2003 at 05:20 PM.
 
Old 02-14-2003, 05:17 PM   #67
fancypiper
LQ Guru
 
Registered: Feb 2003
Location: Sparta, NC USA
Distribution: Ubuntu 10.04
Posts: 5,141

Rep: Reputation: 60
Quote:
Originally posted by Allen614
Heh heh,wondered when you'd get around to posting that "cdrecord" bit. I saved it to file and canned all those GUI frontends a while back. Thanks again.
My doctor (mandrake user because he thought he wanted gui stuff) is starting to use those commands now as he created quite a few coasters using that gui stuff that hides everything from you.

It seems that the commands work as advertized and gui front ends can be flakey in my experience.
 
Old 02-14-2003, 05:20 PM   #68
ferreter
Member
 
Registered: Oct 2002
Location: USA, IL
Distribution: Debian/Gentoo/Slack
Posts: 215

Rep: Reputation: 30
To add to this from above:
Quote:
# Find a process by name
ps -ef | grep -i <plain text>
For example, XCDroast
ps -ef | grep -i xcdroast
To kill a process by name, terminal, username, or PID use skill (part of the procps tools package)

For instance to freeze a user on terminal 2 do this:
skill -STOP pts/2

and release those proccesses like so:
skill -CONT pts/2

you can also use snice to renice all of a users processes

snice +5 user

find all processes associated with httpd:

pgrep httpd

And I don't know if this one was mentioned but vmstat for virtual mem. and cpu stats.
 
Old 06-12-2003, 02:41 PM   #69
tcaptain
LQ Addict
 
Registered: Jul 2002
Location: Montreal
Distribution: Gentoo 2004 from stage 1 baby!
Posts: 1,403

Rep: Reputation: 45
Less with colors (thanks to moses)

moses posted this in another thread...but I think its such a cool tip I'm gonna re-post it here.

Using the dir colors with less:

ls --color=always | less -R

I think that's pretty neat....I had resigned myself to plain ol' console colors with less



thanks to moses on that one.
 
Old 06-12-2003, 02:51 PM   #70
fancypiper
LQ Guru
 
Registered: Feb 2003
Location: Sparta, NC USA
Distribution: Ubuntu 10.04
Posts: 5,141

Rep: Reputation: 60
Modem problems

# Modem and connection troubleshooting
Modem NHFs
Modem HOWTO
Linmodems.org
Conexant/Rockwell modem HOWTO
The Unofficial PCTel Linux Driver page
A possibly helpful thread
Linux driver for Winmodems with Lucent Apollo (ISA) and Mars (PCI) chipsets
Lucent AMR modem listed as an Intel AC'97 - Smart Link Modems
The kppp Handbook
Dial-up Networking Configuration Using KDE's Kppp
Troubleshooting ISP Connection Problems
Connecting to AOL with Linux

# Configuring a pci modem
To configure a pci modem, open an x terminal and su - to the root account:
Code:
[phil@fancypiper phil]$ su -
Password: 
[root@fancypiper root]# cat /proc/pci
Look for your modem in the returned list. Look for something similar to mine:
Code:
  Bus  2, device   2, function  0:
    Communication controller: PCI device 151f:0000 (TOPIC SEMICONDUCTOR Corp) (rev 0).
      IRQ 5.
      I/O at 0xc400 [0xc407].
With this info, I use the setserial command:
Code:
[root@fancypiper root]# setserial /dev/ttyS2 irq 5 port 0xc400 uart 16550a
Then I test the modem with the internet connection wizard and it works. I edit /etc/rc.d/rc.local and enter the setserial command:
Code:
[root@fancypiper root]# pico -w /etc/rc.d/rc.local
My file for an example
Code:
#!/bin/sh
# Redhat /etc/rc.d/rc.local file
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.

touch /var/lock/subsys/local
# configure modem
setserial /dev/ttyS2 irq 5 port 0xc400 uart 16550a
Now, it remains configured after a reboot.
 
Old 06-13-2003, 06:26 AM   #71
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Type less using functions

Do a lot of parsing log lines using cut, awk etc etc?
Adding this function to your functionlib or .bashrc
function sepsp() { tr -s" "|cut -d " " -f$@; }
and now you can "cat <someFile> | sepsp 2,6-".
Saves you typing 19 chars each time.
 
Old 06-13-2003, 01:50 PM   #72
fancypiper
LQ Guru
 
Registered: Feb 2003
Location: Sparta, NC USA
Distribution: Ubuntu 10.04
Posts: 5,141

Rep: Reputation: 60
Customize your bash prompt.

Try this in the user and root .bashrc files for a neat bash prompt with date, time, working directory and color.

user:
Code:
export PS1="\d \@ \[\e[32;1m\]\u\[\e[34;1m\]@\[\e[36;1m\]\H \[\e[34;1m\]\w\[\e[32;1m\] $ \[\e[0m\]"
root
Code:
export PS1="\d \@ \[\e[31;1m\]\u\[\e[34;1m\]@\[\e[36;1m\]\H \[\e[34;1m\]\w \[\e[31;1m\]# \[\e[0m\]"
Prompt magic: Enhancing the system prompt

Last edited by fancypiper; 06-14-2003 at 01:05 PM.
 
Old 06-13-2003, 03:29 PM   #73
titanium_geek
Senior Member
 
Registered: May 2002
Location: Horsham Australia
Distribution: elementary os 5.1
Posts: 2,479

Rep: Reputation: 50
Quote:
Originally posted by Thymox
As far as I'm concerened, with only a couple of exceptions, most British politicians are theives, liars and conmen. But, again, this is taking things (just a little) off topic.
that sounds like most politicians....

but yeah, back on topic, I've found http://www.ss64.com/bash/
(Linux commands)

can anyone tell me of a better one?

titanium_geek
 
Old 06-13-2003, 04:59 PM   #74
fancypiper
LQ Guru
 
Registered: Feb 2003
Location: Sparta, NC USA
Distribution: Ubuntu 10.04
Posts: 5,141

Rep: Reputation: 60
This directory of Linux commands is from Linux in a Nutshell, 3rd Edition

Alphabetical Directory of Linux Commands
 
Old 06-13-2003, 05:16 PM   #75
fancypiper
LQ Guru
 
Registered: Feb 2003
Location: Sparta, NC USA
Distribution: Ubuntu 10.04
Posts: 5,141

Rep: Reputation: 60
Compiling kernel modules

You will need to have installed:
1. The developmental packages (compiler)
2. The kernel source code that matches your running kernel
3. The module source or install code

Check out your system and see what's under the hood and see if you installed the stuff you need to do the job. Open an x terminal and type in this sequence of commands to see what kernel we are running and see if you have the kernel source installed:
Code:
[phil@uilleann phil]$ su -
Password: 
[root@uilleann root]# uname -r
2.4.18-3
I am running kernel version 2.4.18-3. Do I have the proper source code?
Code:
[root@uilleann root]# cd /usr/src
[root@uilleann src]# ls -alc
total 3
drwxr-xr-x    4 root     root          136 Jun 12 14:53 .
drwxr-xr-x   16 root     root          424 Jun  4 12:04 ..
lrwxrwxrwx    1 root     root           14 Jun  4 12:11 linux-2.4 -> linux-2.4.18-3
drwxr-xr-x   16 root     root          584 Jun  4 12:11 linux-2.4.18-3
drwxr-xr-x    7 root     root          168 Jun  4 12:08 redhat
[root@uilleann src]#
I do have the same kernel version source code installed in the directory /usr/src/linux-2.4.18-3 and there is a symbolic link named linux-2.4 pointing to it.

If you don't see something similiar to this (but in color), you will need to install the kernel source.

NOTE: I noticed that Red Hat didn't make the symbolic link /usr/src/linux that all of the INSTALL files that I have read mentioned that I need, so I may as well make one now to save editing the files in the source code to install.So, I'll make it just now:
Code:
[root@uilleann src]# ln -s linux-2.4.18-3 linux         
[root@uilleann src]# ls -alc
total 3
drwxr-xr-x    4 root     root          160 Jun 12 15:46 .
drwxr-xr-x   16 root     root          424 Jun  4 12:04 ..
lrwxrwxrwx    1 root     root           14 Jun 12 15:46 linux -> linux-2.4.18-3
lrwxrwxrwx    1 root     root           14 Jun  4 12:11 linux-2.4 -> linux-2.4.18-3
drwxr-xr-x   16 root     root          584 Jun  4 12:11 linux-2.4.18-3
drwxr-xr-x    7 root     root          168 Jun  4 12:08 redhat
[root@uilleann src]#
Ah, there it is, so that's done.

Next, did I install the compiler?
Code:
[root@uilleann src]# gcc -v          
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/2.96/specs
gcc version 2.96 20000731 (Red Hat Linux 7.3 2.96-113)
[root@uilleann src]#
Yes, I have a compiler installed.

If you don't have those two things installed, you have to install them first off your install CD.

If they are installed, download the source and happy comiling. Make sure you carefully read the README and INSTALL files after extracting and before compiling/installing.

# Guides to software and installation and uninstallation
LNAG - How do I install a program I downloaded from the Internet?
Rute Guide's software explanation
You might want to check out CheckInstall to manage source code installations/uninstallation

# Find software here
The table of equivalents, replacements, analogs of Windows software in Linux
Freshmeat
Sourceforge
rpmfind

Last edited by fancypiper; 06-18-2003 at 09:38 PM.
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Wargame Hints? the_p0et Linux - Security 3 10-19-2003 11:04 PM
hints and tips bigjohn LQ Suggestions & Feedback 0 08-04-2003 01:48 PM
Slackware CUPS hints mi6 Slackware 3 06-05-2003 08:56 PM
Hints - process myquestion Programming 2 04-15-2002 07:26 PM
gcad hints ? jamaso Linux - General 0 03-02-2002 08:27 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 12:30 PM.

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
Open Source Consulting | Domain Registration