View Full Version : <==== Linux Tricks/Tips======>
healtheworld
10-15-2003, 01:49 PM
Share ur linux tips to simplify....
One thing I like to do is paste this into my /etc/profile file:
DEFAULT="\[\033[0;0m\]"
BLACK="\[\033[0;30m\]"
BLUE="\[\033[0;34m\]"
GREEN="\[\033[0;32m\]"
CYAN="\[\033[0;36m\]"
RED="\[\033[0;31m\]"
PURPLE="\[\033[0;35m\]"
BROWN="\[\033[0;33m\]"
LGRAY="\[\033[0;37m\]"
DGRAY="\[\033[1;30m\]"
LBLUE="\[\033[1;34m\]"
LGREEN="\[\033[1;32m\]"
LCYAN="\[\033[1;36m\]"
LRED="\[\033[1;31m\]"
LPURPLE="\[\033[1;35m\]"
YELLOW="\[\033[1;33m\]"
WHITE="\[\033[1;37m\]"
then I can set up my PS1's using $WHITE or what ever color I want through out my Command prompt and just add $DEFAULT at the end so the text you type isnt colored
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~``
find this usefull for manually running my backup scripts.
To run a command line program in background:
Follow your command with an &
$./mycommand &
healtheworld
10-15-2003, 01:50 PM
CD burning tips
Some CD burning tips:
# Burn an ISO to disk
cdrecord -v speed=5 dev=0,0,0 -data /path/to/foo.iso
# Burn from disk to disk
cdrecord -v dev=0,0,0 speed=5 -isosize /dev/cdrom
# Generate an ISO from a directory.
mkisofs -J -r -o foo.iso /path/to/directory
mkisofs -v -r -T -J -U -V "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
for i in *.mp3; do mpg123 -w `basename $i .mp3`.wav $i; done
# 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=5 dev=0,0,0 /path/to/*.wav
healtheworld
10-15-2003, 01:52 PM
a quick way to see what services are open via inetd on your machine.
grep -v ^# /etc/inetd.conf
healtheworld
10-15-2003, 01:52 PM
To those who aren't familiar with grep, here's the explanation:
grep <options go here> <pattern(s) you want to search for> <filename>
is the syntax for grep.
So if you search for foo in a file called bar.txt, you do this:
grep foo bar.txt
However, if you want grep to display all lines which don't contain foo in the file bar.txt, you use the -v option, as follows:
grep -v foo bar.txt
Which leaves only the explanation of the ^ thingie.
If you want to search for all lines starting with the word foo in the file bar.txt, you use this:
grep ^foo bar.txt
So logically, if you want all lines not starting with foo in bar.txt, you use this:
grep -v ^foo bar.txt
BTW you can use multiple patterns too, like this:
grep "foo bar" bar.txt
healtheworld
10-15-2003, 02:01 PM
DOES LINUX SUPPORT NTFS?????
All modern Linux kernels (all 2.4.x and many 2.2.x) DO support NTFS in read-only mode.
Long Answer:
Although you can read NTFS partitions created with any version of Windows NT, you can not WRITE to an NTFS partition created with Windows 2000, XP, or anything yet to come. NTFS partitions created with Windows NT 4.0 and earlier CAN be written to, but this tends to make a mess of the filesystem, so make sure to do a chkdsk when you boot into NT after writing from Linux.
Below are in-depth instructions on how to gain access to your NTFS partition form Linux.
To access your NTFS partition:
1. Open a shell if you haven't already.
2. Become root. Do this by running su and entering your root password when prompted.
3. Create a mount point for the NTFS partition. mkdir /mnt/ntfs
4. Mount your NTFS partition. mount -t ntfs -o umask=000 /dev/device /mnt/ntfs
Replace device with the name of your NTFS partition. See below for advice on how to find this if you don't know.
5. The contents of the NTFS partition is now part of your tree. When you want to access a file on it, just think of /mnt/ntfs as C:\ and you're all set.
6. When you are done, repeat steps 1 and 2 (if you exited the shell) and run umount /mnt/ntfs
If you want all that to be done automatically when you boot Linux (doesn't take effect until you reboot of course):
1. Open a shell and become root as described before.
2. Open your fstab file. kedit /etc/fstab
Note that this assumes you have KEdit (part of the kdeapps package) installed. If you don't, replace kedit with vim, xemacs, gnotepad, or whatever text editor you like.
3. Add this line somewhere in the file:
/dev/device /mnt/ntfs ntfs umask=000 0 0
4. Save and exit.
healtheworld
10-15-2003, 02:03 PM
Sharing files between Windows and Linux
--------------------------------------------------------------------------------
Question: How do I access shared files and folders from Windows computers, and how do I share files and folders on Linux?
Answer: Samba
Explanation:
All versions of Windows, and even MS-DOS, use the SMB protocol to share files and printers, and also to handle authentication. Samba implements almost all of SMB's functionality on *NIX systems, allowing them to take the role of a Windows NT domain controller. But most of us just use it to access Windows shares on Linux. This FAQ will tell you how to do just that.
This FAQ assumes you have Samba installed and properly configured, and that your kernel supports smbfs. If you're running a distro made in the last 2 years, it's safe to assume you're all set.
To access shared folders in Linux:
1. Open a shell.
2. Become root. su and enter your root password when asked for it.
3. Create a mount point for the shared folder. mkdir /mnt/share
4. Mount the shared folder. mount -t smbfs -o username=username,password=password //compname/sharename /mnt/share
Replace username with your username on the other box and password with the associated password. Replace compname with the name of the computer, and sharename with the name of the share.
If you didn't get any errors, you're all set. The folder is "mapped" to /mnt/share.
If you DID get an error, this part might help:
If the error said "can't open /etc/smb.conf: no such file" or something like that, ignore it. You don't need a config file just to mount shares.
If the error said "wrong fs type or bad superblock on //compname/sharename", it means samba isn't installed. Install it and try again.
If it said "unknown filesystem smbfs" or "kernel doesn't support smbfs" or something like that, it means you don't have smbfs support in your kernel. Run modprobe smbfs and try again. If it still doesn't work, you will have to build a new kernel with SMB support enabled.
If it says "couldn't connect to compname", open your /etc/hosts file and add an entry for the computer you're trying to connect to.
I think I've covered everything that could possibly go wrong with mounting, so let's move on to sharing.
To share directories on Linux:
1. Open a shell and become root, as described before.
2. Open your /etc/smb.conf file. kedit /etc/smb.conf (replace kedit with your favorite editor if you want)
3. Alter it like so:
1. Change the WORKGROUP setting to the name of the workgroup you want to be in.
2. The HOSTS ALLOW line should contain the list of IP ranges that are on your home network. For example, if your computers were all 192.168.0.* your line would look like this:
hosts allow = 192.168.0. 127.
3. Set ENCRYPT PASSWORDS to "yes"
4. Set SMB PASSWORD FILE to "/etc/smbpasswd"
5. On the INTERFACES line, list all of your computer's IP addresses, except the internet address if it has one. For example, if you computer had a loopback IP 127.0.0.1, an internal IP 192.168.0.1, and an internet IP 25.246.105.108, your line would be:
interfaces = 192.168.0.1 127.0.0.1
6. Save it and exit the editor.
4. Add an account for your Windows box. smbpasswd -a user password
Replace user with the username you want. and password with a password. The username should be a valid user on the Linux box.
5. Open up /etc/smb.conf again.
1. Scroll down to the Share Definitions part.
2. The first chunk would be the homes section. Edit it as neccissary to make it match this:
[homes]
comment = Home Directories
browseable = no
writable = yes
3. Now add any other shares you want like this:
[sharename]
comment = Comment
path = /path/to/share
read only = no
public = yes
4. Save and exit.
6. Now start the samba server. nmbd -D and then smbd -D
healtheworld
10-15-2003, 02:04 PM
Calll to PCMECH EXPERTS ...
Do respond to this thread...
Lets collect the tips for everyone to share
healtheworld
10-15-2003, 02:57 PM
Setting up X
*************
No nVidia drivers this time around, but you DO have to reconfigure your environment a bit to make X work. In the interest of modular design, cygwin doesn't do this for you, as that would mean assuming X is installed. That is unacceptable.Note that all of these steps are to be performed in the Cygwin shell.1. vim /etc/profile2. Find the PATH line. Add /usr/X11R6/bin to it. Then save and exit.3. export PATH=$PATH:/usr/X11R6/bin (to make it take effect in the current session)4. man XWin5. Look over the command-line switches in the manpage. Decide which ones you will want to start X with.6. vim /usr/X11R6/bin/startxwin.sh (In cygwin, startxwin.sh is the best way to start X. The more UNIX-like "startx" command also works, but not very well.)7. Find the XWin command in this script. Add the switches you decided on in 5. Also note the twm command. You will be changing that to the window manager you want when you get everything set up. Save and exit.8. /usr/X11R6/bin/startxwin.sh9. If all is well, a window with a stippled background (the infamous monitor- and head-exploding X stipple) and a command prompt window (an xterm) will open. This is your X server in all it's glory. If you set it to run fullscreen, then this display will cover your entire screen, instead of showing up as a window. You can get out of it with ALT-F4 (the windows way) or CTRL-ALT-BACKSPACE (the *NIX way).10. At this point you might want to consider getting a more feature-rich window manager to take the place of TWM. WindowMaker and FVWM are inclued with Cygwin as optional packages. Almost any window manager should compile and run without much hassle. KDE 2.2 is available as well if you want that. Either way, when/if you install a new window manager, just open up /usr/X11R6/bin/startxwin.sh and find the twm command, and replace it with the command to run your window manager
healtheworld
10-15-2003, 05:07 PM
CONFIGURE TV OUT(NVIDIA)
*****************
1. Hook your TV up to your card somehow. I do it by attaching the SVideo-to-RCA adapter to the card, and putting an RCA cable between the adapter and my VCR.
2. Open up your /etc/X11/XF86Config file in whatever text editor you like. You will need root priviledges to save the file, so make sure you launch the editor from a root shell, or use some other method to suid root the editor.
3. Add this entry below your monitor section in the file:
--------------------------------------------------------------------------------
Section "Monitor"
Identifier "TV1"
HorizSync 30-50
VertRefresh 60
Option "TVStandard" "tv type"
Option "TVOutFormat" "COMPOSITE"
EndSection
--------------------------------------------------------------------------------
Replace tv type with the type of TV you're hooking it up to. If it's a TV from North America (US and Canada) you'd put NTSC-M here. I think TV's from most European countries are PAL-I. There's a big list of countries and their TV standards in the readme file. This can be found at /usr/share/doc/NVIDIA_GLX-1.0/README
4. Add this line at the end of your Device section.
Option "ConnectedMonitor" "TV"
5. Save the file.
6. Restart X, and the display will come up on your TV instead of your monitor.
7. Watch some DivX movies, or fire up a console emulator, or do any number of things that you'd rather do with a TV than with a monitor.
8. When you are ready to go back to your monitor, open up the /etc/X11/XF86Config file and delete the ConnectedMonitor line you added in step 4, then save and restart X.
healtheworld
10-15-2003, 05:08 PM
APPLICATIONS INSTALL IN GENTOO
*****************************
1. Check to make sure the application that you want is in ebuild format by going here.
2. Now, type the command emerge rsync to update your portage tree which stores a list of all of the latest ebuilds so your computer knows what it can download and install.
3. Type in emerge --pretend app replacing app with the apps name on the package list. This will tell you all of the dependencies (other applications required in order for the application that you want to work), and will also give you an idea of how long it will take to install, the longer the list of dependencies the longer it will take usually.
4. Take out the pretend flag (--pretend) in the command that you typed in step 3.
5. Sit back and wait for the application to download and install.
healtheworld
10-15-2003, 05:11 PM
USING LINUX AS A ROUTER (WITHOUT DEDICATED FIREWALLS)
******************************************
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -j MASQUERADE
iptables -A FORWARD -s 192.168.0.0/24 -j ACCEPT
echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_all
Then just set up your other systems just like you would if you were using ICS on a windows box
healtheworld
10-15-2003, 05:13 PM
Dual booting Windows and Linux using LILO
************************************
WinNT and Linux on one hard drive
=====================
Install Linux. When asked, install LILO in the MBR. I don't think Windows NT will trash the MBR when a bootloader exists there, but make a boot disk just in case!
Install Windows NT. If it doesn't wreck LILO, you will end up back in Linux after the text-mode install finishes. Otherwise, complete the install and then use your boot disk to get back to Linux.
Once you are in Linux, open up /etc/lilo.conf in your favorite text editor, and add this to the bottom, below the image= stanzas.
other=/dev/hda3
label=WindowsNT
The other= line tells LILO that it's booting an "other" (not DOS, not Linux) OS that is able to boot itself. The /dev/hda3 part tells it what partition to try to boot. If you used the partition example I suggested above, and you're doing this with the Primary Master IDE drive, then /dev/hda3 will be correct. The label= entry can be anything, but you cannot use spaces.
5. Save the file.
6. Run /sbin/lilo -L
The -L switch tells LILO to use LBA32 mode. Unless you have a <2GB hard drive, you will need this switch. If all is well, you'll see some "Adding" lines, then the prompt will return. One will have a * after it, that is the default entry. Now you may reboot, and Windows will be an option in the LILO menu. You are done!
WinNT and Linux on seperate hard drives
==========================
1. Jumper the Linux hard drive to be the master, and the NT drive to be the slave.
2. Hook them both up to the primary IDE channel.
3. Boot. You will get LILO and end up in Linux.
4. Open up /etc/lilo.conf, and add this to the end of the file:
other=/dev/hdb1
label=WindowsNT
table=/dev/hdb
map-drive = 0x80
to = 0x81
map-drive = 0x81
to = 0x80
Here's the line-by-line explanation:
other=/dev/hdb1: Tells LILO to boot an OS from the first partition on the primary slave drive.
label=WindowsNT: Tells LILO what this OS should be called.
table=/dev/hdb: Tells LILO to use the partition table from the primary slave drive.
map-drive = 0x80 / to = 0x81: Tells LILO to remap device 80 (primary master IDE drive) to 81 (primary slave).
map-drive = 0x81 / to = 0x80: Same as above, but in reverse.
5. Save the file.
6. /sbin/lilo -L
Reboot, and Windows will be a boot option. If you choose it, LILO will trick it into thinking it is on the Primary Master drive, when in fact it is on the Primary Slave.
healtheworld
10-15-2003, 05:18 PM
ONE COOL TIP THAT I HAVE FOUND
***************************
Here's a trick (needs broadband)
1. First, ensure you have xmms installed with the mpeg layer 1,2,3 plugin.
2. Go to www.shoutcast.com (or any other streaming audio site) and get some streaming audio going (just click "tune in" and then open with xmms)
3. In XMMS: options - preferences - audio I/O - mpeg layer 1,2,3 player - configure - streaming
4. Enable "save stream to disk" and pick the path of a nice fat directory to save to MP3 stream to.
5. Now, press play again on xmms and it will start recording the stream.
6. The fun part... at the CLI, type the following:
at now + 500 minutes
and press enter. You should get another "command prompt" for at, and type:
killall -9 xmms
and press enter. Now do a
ctrl-d
To tell "at" that you are finished.
Then go to sleep. When you wake up, you will have a 500 minute MP3 that you can burn to a CD.
I also used the "at" command, left a blank CD-R in the drive, and had the disk burned for when I woke up!
healtheworld
10-15-2003, 05:19 PM
Do share dudes...
Waiting for some great tips
healtheworld
10-15-2003, 05:23 PM
Suppose you want to rename all .txt files to .doc
cat ~/bin/ext
#!/bin/bash
for i in *.$1
do
NEW=`echo $i|sed 's/\..*$//'`.$2
mv $i $NEW
done
I call it like this:
$ ls
a.txt b.txt c.txt d.txt
$ ext txt doc
$ ls
a.doc b.doc c.doc d.doc
healtheworld
10-15-2003, 05:24 PM
Hey Dudes..
Hundreds Of Experts..Here..
Do Let us know Some of ur secrets
.....
healtheworld
10-15-2003, 05:25 PM
Why ask a question that has already been answered very thoroughly in documentation? All it does is make you look stupid when you do it. BTW, here is my 3 step process that will solve almost all your Linux problems.
1) GAFC = Get a f------ clue.
2) RTFM = Read the f------ manual.
3) STFW = Search the f------ web.
99% of your questions will be answered that way
healtheworld
10-15-2003, 05:27 PM
To kill an X-application:
If you have a command line, type xkill; your cursor will change to a skull and crossbones :-D Clicking on any window will kill it (note - it won't necessarily kill all the processes associated with this window. Do a ps ax | grep <partofprocessname> to find any remaining PID's associated with that program or process.
If you're really lazy, or for some reason you don't have access to a command-line, Ctl-Alt-Esc will invoke xkill from the keyboard (at least under KDE; I suspect it's a feature of XFree86)
healtheworld
10-15-2003, 05:28 PM
The easiest way to resolve dependencies is by using apt for RPM. But if you haven't gotten around to installing it yet, you can use the command
rpm -qR -packagename
to list all the packages an installed package depends on.
If you want to check on a package that hasn't been installed, use
rpm -qpR -fullpackagename
healtheworld
10-15-2003, 05:31 PM
I have completed list of mine..
Now Please Do Share Ur Cool tips..
healtheworld
10-16-2003, 11:06 AM
Hey Linux Guys ...\\
Do let us know some cool/smart/handy tips...
Please
healtheworld
10-16-2003, 11:11 AM
rpm -qa : list every rpm installed on your system
rpm -ql package-name : list the installed files associated with rpm package-name (it should be noted the version # of the package-name can be omitted. Ex: openssh-2.3.1 can be abbreviated openssh). To list the files in an uninstalled rpm use the same command only add the -p option: rpm -qpl package-name
rpm -qa | grep regexp : check to see if rpm conatining regexp in its name is installed on your system.
rpm -i package-name : install rpm package-name (must be root). Also by adding the --test option you can check for depency problems before actually installing.
rpm -U package-name : same as above only Upgrade instead of just install.
rpm -qi package-name : list info about package-name. This gives you a general idea of what the package does, what system it's intended for and who put it together. You can also query info from uninstalled packages with with the -p option: rpm -qpi package-name
rpm -qf filename : VERY IMPORTANT. Query file filename to see what RPM package it belongs to. This will keep you from deleting a file you think is useless.
One last trick. Many people complain about RPM dependency problems. The easiest way to solve these are by using www.rpmfind.net. You can query by a filename or an RPM name. Also if you know you have all the RPMs required to do an install but don't know which ones to install first you can specify them all on the command line with a glob character '*.rpm' and let the rpm command sort out the dependencies itself.
healtheworld
10-16-2003, 11:14 AM
Can I run Windows software on UNIX?
--------------------------------------------------------------------------------
As strange as it sounds, yes. You can run SOME Windows software on UNIX systems using WINE.
WINE is a recursive acronym that means "WINE Is Not an Emulator", but it could easily mean "Windows Is Nearly Exinct". It runs on Linux, FreeBSD, and Solaris, and possibly some other *NIX variants too. It is a free implementation of the Win32 API that, among other things, lets you run Windows software on *NIX.
There are several independantly maintained "forks" of WINE, in addition to the "official" tree maintained by WINE Headquarters. The most popular fork, even more popular than the official tree, is WineX, a gaming-centric fork maintained by Transgaming Technologies. This fork has the distinct advantage of DirectX 8.0 support, allowing you to play many recent Windows games. I use WineX, so the instructions in this FAQ will be based on it, but most, if not all, of it should work just fine with the official tree, which will be referred to throughout this FAQ as WineHQ.
Before you can use WINE, you need to install it. Binary releases (RPMs, apt-gettable packages, ports, etc) are available, but are often outdated. If your distro comes with a WINE package, don't install it, or if you already did, remove it. By following this FAQ, you will be getting the WINE source code from a CVS server, and compiling it yourself.
You must now decide if you want the WineHQ or WineX version.
NOTE: In the commands below, wherever it says : pserver: below, remove the space between the colon (: ) and pserver. I had to add the space to keep the forum from screwing it up.
To get the WineHQ source:
1. Open a shell window.
2. cvs -d : pserver:cvs@cvs.winehq.com:/home/wine login
3. You will be asked for the password. It is cvs
4. cvs -z3 -d : pserver:cvs@cvs.winehq.com:/home/wine co wine
Or, to get the WineX source:
1. Go to Transgaming's Site and read the licence.
2. Open a shell window.
3. cvs -d : pserver:anonymous@cvs.winex.sourceforge.net:/cvsroot/winex login
4. You will be asked for the password. Just hit enter.
5. cvs -z3 -d : pserver:anonymous@cvs.winex.sourceforge.net:/cvsroot/winex co -r winex-2-0-branch wine
Either way, the last command will begin the download. It will take a few minutes. When it is done, you will have the source code in the wine subdirectory of wherever you were when you ran the above commands. You will need to compile and install it next.
While still in the shell window:
1. Become root. su and enter your root password when asked.
2. cd wine
3. tools/wineinstall
4. It will take a long time for WINE to compile, so go do something productive.
5. When it is done compiling, it will ask a few questions. If I recall correctly, they are all yes/no questions, and you should answer 'yes' to all of them. If the setup program asks for a "fake windows root" directory, it will offer a default setting of /c. Accept that.
6. Open /etc/ld.so.conf in a text editor. If there is a /usr/local/lib line in it, no changes need to be made. If there isn't, add it.
7. ldconfig
8. chmod -R 777 /c
8.5. Optional for better performance, but a very serious security risk: chmod 777 /dev/mem
9. exit
10. cd ~
11. su and enter root password when asked.
12. chown -R (your username) .wine
13. exit
14. which wine
If it says /usr/local/bin/wine you're all set. If it says No wine found in {big list of directories} then do export PATH=$PATH:/usr/local/bin
Now WINE is installed, but you still have to do some additional configuration before you can run all of your favorite Windows apps.
1. Open ~/.wine/config in a text editor.
2. The first few stanzas define the drive letters that your Windows software will see. Make sure the Floppy and CD-ROM sections point to the proper locations.
3. Now scroll down to the x11drv section. Here you will find options that control the appearance of Windows apps. The following settings are good to know:
PerfectGraphics: The performance hit isn't that bad, and has no effect on games. Set this to Y.
Managed: This makes Windows apps behave more like proper X client apps. I set this to N, and run WINE with the --managed switch when starting an app I want to use like this.
Desktop: When this is uncommented, Windows apps will be confined to a window whose demensions are specified here. Some games won't work if this is enabled, some won't work if it isn't enabled. This is one of the many things to play with if a program doesn't work at first. Put a semicolon (; ) in front of this line to disable it, and remove the semicolon to enable it.
DesktopDoubleBuffered: Set this to Y.
4. Save the file and exit the editor.
It is now time to give things a little test.
1. Find a simple Windows app, such as Notepad, or SkiFree, or something like that.
2. Put it in the /c directory.
3. cd /c
4. wine ./appname.exe
5. If all has gone well, you will see some font-related stuff scroll by for awhile, and then the app will appear. If it doesn't, chances are you got some bad source code. Uninstall WINE and try again...
If all went well with that test, it's time to put WINE to some serious use. Try installing Microsoft Office, or your favorite Windows game. Keep in mind that very few games work perfectly, and most don't work at all.
WINE must be run from a command line. The basic structure of the command is:
wine --wine --switches -- ./appname.exe -app -switches
The final -- before the ./appname.exe tells WINE that the switches that follow are for the Windows app, not WINE. For example:
wine --debugmsg -all -- ./MaxPayne.exe -developer
The above will tell WINE not to show any debugging messages, and to pass the -developer switch to the app (Max Payne in this case. It enables the console, allowing entry of cheat commands! )
Omitting the --, however, will have fatal consequences:
wine --debugmsg -all ./MaxPayne.exe -developer
The above would produce an error, since WINE doesn't understand the -developer switch.
Congratulations, you have now successfully run a Windows app on UNIX! The only thing worse for Microsoft would be another barrage of pies in Bill Gates' face.
If you want to uninstall WINE:
1. Open a shell window.
2. Become root. su and enter root password when asked.
3. cd to the directory containing the WINE source code.
4. make uninstall
healtheworld
10-16-2003, 11:20 AM
mount -t vfat -o ro,umask=222 device mount-point
Description:
mount: Runs mount
-t vfat: Specifies FAT filesystem with long filenames
-o ro,umask=222: ro causes the filesystem to mount read-only, umask=222 makes every file have read+execute permissions.
healtheworld
10-16-2003, 11:20 AM
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 <plain text>
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 > <filename>.txt
rpmquery --all | grep -i <plaintext> /* find specific rpms with name in them */
# What directory am I using
pwd
Look at man <command> or info <command> for the flags and options you can use for bash commands
vBulletin® v3.7.0, Copyright ©2000-2008, Jelsoft Enterprises Ltd.