Search:  

 
 
   All ForumsHot TopicsGallery






how-to block ads


 
Forums » Tech and Talk » OS and Software » All Things Unix » Little Known Tips and Tricks...
Search Topic:
Uniqs:
25785
Share Topic:
RSS topic:
toggle:
flat / full
normal / watch
Posting:
Post a:
Post a:
Gaim alternatives? »
« Need Light Network Enabled Distro..  
page: 1 · 2 · 3 ...10 · 11 · 12 · 13 · 14
AuthorAll Replies


toadlife
Premium
join:2004-05-03
Lemoore, CA
·AT&T Yahoo

reply to dom6791
Making make leave you alone in FreeBSD

If you run FreeBSD as your desktop, and you frequently run portupgrade or portmanager to update your ports, you may have started an update of your ports and gone to bed while it compiles only to find in the morning that it stopped somewhere in the middle of compiling to ask you a configuration question about one of the programs.

To keep make from asking you any questions, put the following line in /etc/make.conf
BATCH=YES

With batch mode enabled, make will use the default options when compiling ports.

If you don't want batch mode to be turned on by default, you can pass the option to portupgrade when you run it.

With portupgrade, the option...
-m BATCH=YES
...will cause portupgrade to pass the batch=yes to the make command each time it compiles.

With portmanager, you cannot (AFAIK) pass arguments to make, so you would have to have the argument in make.conf

To pass the batch argument when compiling a single port (useful with huge meta-ports like kde), you can pass the batch argument like so...

make BATCH=yes install clean


Happyrat
Google Is Your Best Friend
Premium
join:2002-07-01
Disneyland

reply to dom6791
Painless Package Updates for SuSE

Using YaST and a few custom repositories it's possible to easily update all of your applications in SuSE Linux (Any Version)...

Follow the instructions listed here on the SuSEwiki

»susewiki.org/index.php?title=Upd···via_YaST

And here's a couple of Listings of Repositories to make your life a little easier in this process...

»susewiki.org/index.php?title=Finding_RPMs

»en.opensuse.org/Additional_YaST_···sitories

»www.novell.com/products/suselinu···ors.html

Choosing the right mirrors and directories will depend on which version of SuSE you are running...
--
Crime wouldn't pay if the Government ran it...»www.fuzzyrat.com


Eatmeingreek
Gentard

join:2001-06-29
San Francisco, CA

reply to Steve
Re: Little Known Tips and Tricks...

said by Steve See Profile :

Symbolic permissions with chmod are a list of "sets", each of which is

scope
operation
permissions...
I take back everything I said about this. Your little guide there came in very handy today.

gatessux

join:2001-01-13
Lutz, FL


1 edit
reply to fritzmp
said by fritzmp See Profile :

File Permissions: Some no0bs don't understand the number system that is associated with files and directories.

Read is worth a 4, Write is a 2, and execute is 1. Add them up for 7. chmod 700 file_or_directory is a owner rwx/7 group 0 and others/world 0

grid

******owner group world

read=4--X-----X-----X

write=2-X-------------

exec=1-X-----X-----X

Thus the above=755
Sorry, I should of read all the replies before posting this...
Good one, I just wanted to furthur help out...
It's binary, as stated above, you need to do it 3 times for each, User of the file, Group that has rights, and Others (everyone else).

Here's a cheat table...
------------
RWX
000 = 0, no rights
001 = 1, eXecute
010 = 2, Write
011 = 3, Write/eXecute
100 = 4, Read
101 = 5, Read/eXecute
110 = 6, Read/Write
111 = 7, Read/Write/eXecute

(if it's 0 it's false, if it's 1, it's true)

Also:
chown = change owner, chgrp = change group
A great reference can be found here as well :
»www.tldp.org/LDP/intro-linux/htm···_04.html

Thanks...


Steve
I'm a PC, so shut up
Consultant
join:2001-03-10
Yorba Linda, CA

reply to dom6791
Wow, just tripped across something in Linux by accident: the x option to the ps command. Running ps -afx, it shows all processes with their parent/child relationship - very handy.
# ps afx
PID TTY STAT TIME COMMAND
1 ? S 0:45 init [3]
2 ? SW 0:00 [kflushd]
3 ? SW 0:06 [kupdate]
4 ? SW 0:00 [kpiod]
5 ? SW 0:01 [kswapd]
6 ? SW< 0:00 [mdrecoveryd]
274 ? S 267:19 named -t /chroot/named -u named -c /etc/named.conf
327 ? S 140:15 syslogd -m 0
338 ? S 0:00 klogd
354 ? S 0:00 /usr/sbin/atd
370 ? S 0:00 crond
447 ? S 0:56 /usr/libexec/postfix/master
454 ? S 0:17 \_ qmgr -l -t fifo -u
9737 ? S 0:00 \_ pickup -l -t fifo -u
456 ? S 8:00 /usr/local/sbin/sshd
9754 ? S 0:00 \_ sshd: root@pts/0
9756 pts/0 S 0:00 \_ -bash
9770 pts/0 R 0:00 \_ ps afx
491 tty1 S 0:00 /sbin/mingetty tty1
492 tty2 S 0:00 /sbin/mingetty tty2
Looking back in older versions, it's obviously been around a long time, but today was the first I'd ever seen it.

Nice!

--
Stephen J. Friedl • Unix Wizard • Microsoft Security MVP • Tustin, California USA • my web site


jdong
Eat A Beaver, Save A Tree.
Premium
join:2002-07-09
Rochester, MI
clubs:
reply to dom6791
I thought it was -f that did it, while -x just shows a more complete list of processes?
--
UbuntuForums Administrator: try Ubuntu Linux


deblin
Dark Side of the Moon
Premium,MVM
join:2001-09-01
Middletown, DE

reply to dom6791
Quick and easy way to check for a valid date with "cal", which is pretty ubiquitous.

is_valid=0
cal $mon $year | grep -qw $day && is_valid=1
if [ $is_valid == 1 ]; then
echo "do stuff here if it's a valid date"
else
echo "invalid date entered"
fi

--
"Talk is cheap because the supply is greater than the demand" - Shelby Friedman


Steve
I'm a PC, so shut up
Consultant
join:2001-03-10
Yorba Linda, CA

Why not:
if cal $mon $year | grep -qw $day
then
echo "do stuff here if it's a valid date"
else
echo "invalid date entered"
fi
No need for the variable set when you can check for the result directly in the "if"

Steve — who nevertheless would have not thought to do it this clever way

--
Stephen J. Friedl • Unix Wizard • Microsoft Security MVP • Tustin, California USA • my web site


Mordy
Comfortably Numb
Premium,MVM,ExMod 2004-07
join:2001-12-02
Denver, CO

1 edit
 (topic move) Little Known Tips and Tricks...

Moderator Action
The post that was here (and all 6 followups to it), has been removed.


yock
TFTC
Premium
join:2000-11-21
Fairfield, OH

reply to Steve
Re: Little Known Tips and Tricks...

said by Steve See Profile :

Why not:
if cal $mon $year | grep -qw $day
then
echo "do stuff here if it's a valid date"
else
echo "invalid date entered"
fi
No need for the variable set when you can check for the result directly in the "if"

Steve — who nevertheless would have not thought to do it this clever way

I think a *LOT* of people forget about return codes when shell scripting...myself included. This script is a perfect example of why they're so damned useful.

--
Wiki Wiki
The more secretive a government is, the more skeptical we need to be. --Shepard Smith


timcuth
Braves Fan
Premium
join:2000-09-18
Pelham, AL
clubs:
·AT&T Southeast


1 edit
 reply to gatessux
said by gatessux See Profile :

Sorry, I should of read all the replies before posting this...
Good one, I just wanted to furthur help out...
It's binary, as stated above, you need to do it 3 times for each, User of the file, Group that has rights, and Others (everyone else).

Here's a cheat table...
------------
RWX
000 = 0, no rights
001 = 1, eXecute
010 = 2, Write
011 = 3, Write/eXecute
100 = 4, Read
101 = 5, Read/eXecute
110 = 6, Read/Write
111 = 7, Read/Write/eXecute

(if it's 0 it's false, if it's 1, it's true)

Also:
chown = change owner, chgrp = change group
A great reference can be found here as well :
»www.tldp.org/LDP/intro-linux/htm···_04.html

Thanks...
Could someone expand on the above info to explain "sticky bits"? I have to use them in my job as an Oracle DBA, and I follow the instructions and get them correctly, but I have no idea what they mean or what exactly I am doing.

E.g., some Oracle database programs have to have "chmod 7455" in order to work. If you then display the program, you see "-rwsr-s---". (I am not sure my chmod command example and my mode display match, exactly).

I think it has something to do with the programs running with root authority, but I don't understand the why or the how.

Thanks,
Tim

PS - I knew even less than I thought. The actual chmod command was "chmod 4755" (not 7455) and it is called "setuid". My system administrator saw me do it and he was the one who called it "the sticky bit".

Anyway, I found some info in this article: »en.wikipedia.org/wiki/Chmod

Sorry.
--
The shortest sentence is, "I am". The longest is, "I do".
~ Project Hope ~


timcuth
Braves Fan
Premium
join:2000-09-18
Pelham, AL
clubs:
·AT&T Southeast

  Here is the info I was asking about:

When a binary executable file has been given the setuid attribute, normal users on the system can execute this file and gain the privileges of the user who owns the file (commonly root) within the created process. When root privileges have been gained within the process, the application can then perform tasks on the system that regular users normally would be restricted from doing. The invoking user will be prohibited by the system from altering the new process in any way, such as by using ptrace, LD_LIBRARY_PATH or sending signals to it (signals from the terminal will still be accepted, however).

»en.wikipedia.org/wiki/Setuid

Apparently, the Oracle program I set this on then allows other users to execute it with the privileges of oracle, not root.

Tim
--
The shortest sentence is, "I am". The longest is, "I do".
~ Project Hope ~


timcuth
Braves Fan
Premium
join:2000-09-18
Pelham, AL
clubs:
·AT&T Southeast


1 edit
reply to dom6791
Start a script based on reception of a file

I don't know whether this already has been posted. I really think this thread should be edited into the ATU FAQ, as it is getting to be next to impossible to find anything specific in such a long thread.

Anyway, this week at work I was required to initiate a batch script upon reception of an FTP'ed file, rather than scheduling the job at a regular time. I did a Google search and then added my own twists, coming up with a very nice solution.

Since the batch script runs for about 10 minutes, I decided to check for the incoming file every 15 minutes during the range of times when the file might arrive (3 AM - 9 AM, Tue - Sat):

00,15,30,45 3-9 * * 2-6 /path/check_for_file.sh

check_for_file.sh runs the UNIX find command to look for the incoming file with a timestamp newer than the output file that is created by the batch script. When the newer input file is found, the find command starts the batch script:

find /expimp/blah -name input_file.txt -newer /path/output_file.txt -exec /path/batch_script.sh \;

Works like a charm!

Tim

--
The shortest sentence is, "I am". The longest is, "I do".
~ Project Hope ~


yock
TFTC
Premium
join:2000-11-21
Fairfield, OH

said by timcuth See Profile :

I really think this thread should be edited into the ATU FAQ, as it is getting to be next to impossible to find anything specific in such a long thread.
That's a great idea. If users feel so inclined, they can submit their FAQ suggestions to this page and the system will IM the FAQ editors that there are new suggestions for the FAQ. In fact, Maxo See Profile sent us one just today.

No_Strings See Profile and I are slowly making our way through the FAQ in a massive cleanup effort, so anything you guys can add would be welcome.
--
Wiki Wiki
Laughter is the closest distance between two people. --Victor Borge


Daniel
Premium,MVM
join:2000-06-26
Pleasanton, CA
clubs:


4 edits
reply to dom6791
Re: Little Known Tips and Tricks...

With lsof you can use the -t and -u switches to kill everything a user has open:
kill -9 `lsof -t -u daniel`
Use with care. ;)

dom6791

join:2001-11-23
Bronx, NY

reply to dom6791
Didnt see this one in the list

If you have many files in a directory that you want to execute consecutively, but dont want the hassle of manually running one at a time:

find /tmp/syncfiles -name 'sync*' -exec sh {} \;

This will find all files that begin with 'sync' in the /tmp/syncfiles directory and execute one at a time. This saved me lots of time since it takes 7 hours sometimes. Now I can just start it and walk away.


weeksben1
Premium
join:2004-02-26
Clarkston, MI
reply to dom6791
Just want to say thanks for the tips and tricks. Its great for showing us *nix rookies, some new (at least to us) stuff.
--
Ben WeeksNetwork AdminNovell CNA NW3.2/4.x/5.xNetwork + Certified

ghost16825
Use security metrics
Premium
join:2003-08-26


3 edits
reply to dom6791
Gentoo installer/user tip:

This is more or less a RTFM tip rather than anything really brilliant. (Yes, I admit it - I occasionally do read the manual)

What should really be more prominent in the Official Gentoo docs is the elog system - logs info, warning messages etc when emerging.

#In your /etc/make.conf

#The default save directory for these logs is /var/log/portage/elog/
PORTAGE_ELOG_CLASSES="info warn error log qa"
PORTAGE_ELOG_SYSTEM="save"
#or save_summary for all the critical information in one file rather than separately.

dom6791

join:2001-11-23
Bronx, NY

1 edit
In the event someone ever wanted to list only directories:

for i in * ; do if [ -d $i ]; then echo $i ; fi ; done

hohumdedumdum, True!


hohumdedumdum

@anduin.org

No offense dom6791 See Profile, but that's just crazy. There's no need to do that.

ls -d */

That's it.

Also, your for loop will only work so long as the directory names have no spaces in them.
Forums » Tech and Talk » OS and Software » All Things UnixGaim alternatives? »
« Need Light Network Enabled Distro..  
page: 1 · 2 · 3 ...10 · 11 · 12 · 13 · 14


Friday, 04-Dec 15:24:38 Terms of Use | Privacy Policy | Hosting by www.nac.net - DSL,Hosting & Co-lo | feedback | contact
over 10 years online! © 1999-2009 dslreports.com.republican-creole
page compression OFF
Most commented news this week
· [163] Comcast Releasing Promised Usage Meter
· [145] Avast Antivirus Has Gone Mad
· [120] Comcast Makes NBC Universal Acquisition Official
· [104] Graduate Student Unveils Sprint's GPS Sharing With Feds
· [100] Google Invades ISP, OpenDNS Turf With Google Public DNS
· [81] Latest Consumer Reports Survey Not Kind To AT&T
· [78] FCC Ponders Moving From PSTN To IP Voice
· [74] Sprint Defuses GPS Privacy Media Bomb
· [70] Baltimore To Ban Lazy Cable Installs
· [64] Broadband Killed The Game Console
Most people now reading
· False positive in Avast! or is it real? [Security]
· Warrior tank seem underpowered these days [World of Warcraft]
· Windows 7 boot manager editing questions [Microsoft Help]
· DNS options, what are YOU using? [TekSavvy]
· Long ethernet runs [Wireless Service Providers]
· Linux is terrorist - according to MS... [All Things Unix]
· IMG 1.7 (IMG Updates and Discussion) [Verizon FIOS TV]
· An Excellent Guide About Google Voice And Sip Sorcery [VOIP Tech Chat]
· Google takes aim at browser redirection [Security]