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 > LinuxQuestions.org Member Success Stories
User Name
Password
LinuxQuestions.org Member Success Stories Just spent four hours configuring your favorite program? Just figured out a Linux problem that has been stumping you for months?
Post your Linux Success Stories here.

Notices


Reply
  Search this Thread
Old 11-21-2004, 08:21 AM   #1
mchirico
LQ Newbie
 
Registered: Mar 2004
Distribution: Redhat and direct source
Posts: 27

Rep: Reputation: 15
100 Linux tips and counting


There are over 100 Linux tips and tricks from using encryption, tar, cpio, setting up multiple IP addresses on one NIC, tips for using man, putting jobs into the background, using shred, watch who is doing what on your system, listing system settings, IPC status, how to make a file immutable so that even root cannot delete, ssh key pair generation, keeping 12 months of backups in the system logs, low level tap commands (mt), mount an ISO image as a filesystem, getting information on the hard drive, setting up cron jobs, look command, getting a bigger word dictionary, find out if a command is aliased, ASCII codes, using elinks, screen commands, FTP auto-login, Bash brace expansion, Bash string operators, for loops in Bash, diff and patch, script, change library path (ldconfig), monitor file usage, --parents option in commands, advance usage of the find command, cat tricks, guard against SYN flood attacks and ping, special shell variables, RPM usage, finding IP and MAC address, DOS to UNIX conversion, PHP as command line scripting language, Gnuplot, POVRAY and making anamated GIFs, plus a lot more.

Link to full article (TIP1 to TIP5):
http://prdownloads.sourceforge.net/s...e.txt?download







TIP 5:

Setting up 2 IP address on "One" NIC. This example is on ethernet.

STEP 1 (The settings for the initial IP address)

$ cat /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0
BOOTPROTO=static
BROADCAST=192.168.99.255
IPADDR=192.168.1.155
NETMASK=255.255.252.0
NETWORK=192.168.1.0
ONBOOT=yes

STEP 2 (2nd IP address: )

$ cat /etc/sysconfig/network-scripts/ifcfg-eth0:1

DEVICE=eth0:1
BOOTPROTO=static
BROADCAST=192.168.99.255
IPADDR=192.168.1.182
NETMASK=255.255.252.0
NETWORK=192.168.1.0
ONBOOT=yes

SUMMARY Note, in STEP 1 the filename is "ifcfg-eth0", whereas in
STEP 2 it's "ifcfg-eth0:1" and also not the matching
entries for "DEVICE=...". Also, obviously, the
"IPADDR" is different as well.



TIP 6:

Sharing Directories Amoung Several Users.

Several people are working on a project in "/home/share"
and they need to create documents and programs so that
others in the group can edit and execute these documents
as needed.

$ /usr/sbin/groupadd share
$ chown -R root.share /home/share
$ /usr/bin/gpasswd -a <username> share
$ chmod 775 /home/share
$ chmod 2775 /home/share

$ ls -ld /home/share
drwxrwsr-x 2 root share 4096 Nov 8 16:19 /home/share
^---------- Note the s bit, which was set with the chmod 2775

$ cat /etc/group
...
share:x:502:chirico,donkey,zoe
... ^------- users are added to this group.

The user will need to issue a reset before they can get access. As root you
can test their account.

$ su - <username> "You need to '-' to pickup thier environment '$ su - chirico' "



TIP 7:

Getting Infomation on Commands

The "info" is a great utility for getting information about the system.
Here's a quick key on using "info" from the terminal prompt.

'q' exits.
'u' moves up to the table of contents of the current section.
'n' moves to the next chapter.
'p' moves to the previous chapter.
'space' goes into the selected section.


The following is a good starting point:

$ info coreutils

Need to find out what a certain program does?

$ whatis open
open (2) - open and possibly create a file or device
open (3) - perl pragma to set default PerlIO layers for input and output
open (3pm) - perl pragma to set default PerlIO layers for input and output
open (n) - Open a file-based or command pipeline channel

To get specific information about the open commmand

$ man 2 open

also try

$ man -k <some string>



TIP 8:

How to Put a "Running Job" in the Background.

You're running a job at the terminal prompt, and it's taking
a very long time. You want to put the job in the backgroud.

"CTL - z" Temporarily suspends the job
$ jobs This will list all the jobs
$ bg %jobnumber (bg %1) To run in the background
$ fg %jobnumber To bring back in the foreground

Need to kill all jobs -- say you're using several suspended
emacs sessions and you just want everything to exit.

$ kill -9 `jobs -p`

The "jobs -p" gives the process number of each job, and the
kill -9 kills everything. Yes, sometimes "kill -9" is excessive
and you should issue a "kill -15" that allows jobs to clean-up.
However, for exacs session, I prefer "kill -9" and haven't had
a problem.

Sometimes you need to list the process id along with job
information. For instance, here's process id with the listing.

$ jobs -pl

Note you can also renice a job, or give it lower priority.

$ nice -n +15 find . -ctime 2 -type f -exec ls {} \; > last48hours
^z
$ bg

So above that was a ctl-z to suppend. Then, bg to run it in
the background. Now, if you want to change the priority lower
you just renice it, once you know the process id.

$ jobs -pl
[1]+ 29388 Running nice -n +15 find . -ctime 2 -exec ls -l {} \; >mout &

$ renice +30 -p 29388
29388: old priority 15, new priority 19

19 was the lowest priority for this job. You cannot increase
the priority unless you are root.



TIP 9:

Need to Delete a File for Good -- not even GOD can recover.

You have a file "secret". The following makes it so no one
can read it. If the file was 12 bytes, it's now 4096 after it
has been over written 100 times. There's no way to recover this.

$ shred -n 100 -z secret

Want to remove the file? Use the "u" option.

$ shred -n 100 -z -u test2

It can be applied to a device

$ shred -n 100 -z -u /dev/fd0


Also see (TIP 52).




For TIP 10 to 100 reference the following:
http://prdownloads.sourceforge.net/s...e.txt?download
 
Old 05-05-2005, 03:53 AM   #2
davee
Member
 
Registered: Oct 2002
Location: Ayrshire, Scotland
Distribution: Suse(home) RHEL (Work)
Posts: 263

Rep: Reputation: 30
A tip for the tips...!

Why not have the word TIP on the same line as the tip title, so you can grep the file for all titles?

Dave
 
  


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
Linux and iPod Tips kvas Linux - Hardware 3 10-10-2005 05:07 AM
Counting Device Drivers In A Distribution Of Linux tacoshell Linux - General 2 05-03-2005 01:27 PM
Linux Tips little_ball Slackware 4 06-27-2004 11:41 AM
RBEM56G-100 Xircom RealPort Cardbus Ethernet 10/100+Model 56 Linux Drivers/ Phalk sxa Linux - Laptop and Netbook 1 06-12-2004 11:20 AM
Counting Keystrokes in Linux. Shak Programming 5 12-29-2002 05:27 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General > LinuxQuestions.org Member Success Stories

All times are GMT -5. The time now is 01: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