LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Tricks and hints (https://www.linuxquestions.org/questions/linux-general-1/tricks-and-hints-27957/)

MasterC 08-27-2002 09:47 AM

Wow, that's cool.

I know I should know, but could someone either kindly point me to a thread/webpage on info of what in INODE is, and it's significance to me or anyone.

Thanks

Goatdemon 08-27-2002 02:51 PM

hey heres a potential tip if anyone can give it to me. te he.

id like to hit something like CTRL+* in a terminal and have it execule a command like
./configure &&
make &&
make install &&
make clean

can i do this? and thanks again grand masterc for the && tip.

unSpawn 08-27-2002 03:31 PM

...
 
...

unSpawn 08-27-2002 03:35 PM

"In a UNIX-based operating system, an inode is a computer-stored description of an individual file in a UNIX file system." (whatis.techtarget.com) cuz typing `whatis inode` usually won't work :-]

The CTRL+<key> is a keymap thingie, just like the ca rule in inittab you can define a ley combo to do this, tho I would advice against it unless you I) compile and install everywhere or II)are sure you won't *ever* use that key for something else...
What I do when I have routine business I usually set it up in a function, like
compileNow() { commands; commands; commands; }
now if you're busy incorporating this will also work in your shell's resourcefile like .bashrc:

someSet() {
case "$1" in
on)
alias somecommand0=' command0; command1; command2'
alias somecommand1=' command3; command4; command5';;
off)
unalias somecommand0 somecommand1
esac; }
so when you call someSet on it will alias all the stuff you want, whilst off will unalias stuff.
Basically I did this to clean up while stracing some stuff read in the whole env with a gazillion aliases which ain't kewl :-]

HTH somehow

Goatdemon 08-27-2002 11:54 PM

i assume your responding to my question unspawn... if so i have some questions
1. what do you mean by "compile and install everywhere"
2. what do you mean by "alias and unalias stuff"
3. what does this mean "Basically I did this to clean up while stracing some stuff read in the whole env with a gazillion aliases"
4. what i gather from your post that i edit my .bashrc file, add the lines

someset() { case "$1" in
on)
alias install='./configure; make; make install; make clean'


why have somecommand0 and somecommand1, i dont understand. what does on and off do, why would i use it?

sorry for the questions but i have no idea of what the hell your talking about in your last post. thanks

MasterC 08-28-2002 06:04 AM

Goatdemon, though not complex, it would appear that those are scripts of some sort.

I would (and I should myself ;) ) suggest reading a bit on scripting, or programming to learn advanced functions, and possible ways to do things like this in Linux.

HTH

unSpawn 08-28-2002 07:23 AM

Soz Goat, your reply shows me conciseness ain't all...

Here's a simple example:
Open up your ~/.bashrc and add this function:
makeIt() {
#mod1:
if [ "$(echo $PWD | cut -d "/" -f 1,2,3,4)" = "/home/user/test" ]; then
./configure &&
make &&
make install &&
make clean
fi
}
and below that add the alias for it:
alias make='makeIt'

Now do ". ~/.bash_profile" to reread your shells config files and the "make" command now is an alias for what is specified under the "makeIt" function.

What I mean with "in every dir" is that this alias will work without restraints in every directory, which is probably not what you want. Say you've got a user named user, who only compiles in his /home/user/test directory, we can add (mod1).

Alias assigns a name to a command or sets of commands. Unalias removes the name the command is know by.

Stracing is tracing the execution of something (man strace).


Like masterC says, you should read up al wee bit on scripting, it comes in handy sometimes...

Goatdemon 08-28-2002 01:15 PM

thanks and i'll read up on scripting.

neo77777 08-31-2002 01:51 PM

I've seen a lot of threads asking "how to get my dynamic IP to use in iptables, etc..."
Code:

EXTIF=eth0
IP=`/sbin/ifconfig $EXTIF | grep 'inet addr' | awk '{print $2}' | sed -e s/.*://`

Where EXTIF is an interface which gets assigned dynamic IP, it differs from setup to setup, for instance for ADSL lines with PPPoE it is usually ppp0.

Goatdemon 09-10-2002 12:06 AM

isn't (make; make install) the same as doing (make && make install) ?

MasterC 09-10-2002 04:22 AM

No, I do not think so. make; make install would run make, and even if make faulted, and errored out, make install would still be run; whereas make && make install would actually not run make install if make faulted out. If you are running 15 different things, and just don't want to return to the computer after each one, and they are not dependent upon the other finishing, then ; would be fine.

That is my understanding anyway ;)

Cool

unSpawn 09-10-2002 07:22 AM

Just a lil addition. A nicer way would be to dump an errormsg in between, something like: make; if [ "$?" = "1" ]; then echo "Crapped out on make process"; fi

Another tip is if you're wondering what's happening during install, before installing to do "make -n install" 2>&1 > installer.log" and less(1) the file. Gory details shown come in handy when you're making packages for instance...

Calum 09-10-2002 09:28 AM

Quote:

Originally posted by Thymox
Dai, forgive me for asking, but is Wales considered a seperate country by the EU yet? This is not a flame... I know that Scotland is considered a seperate country, but I thought that Wales was considered as more of a partially-autonomic principality?
fyi, scotland is NOT in any way treated as a seperate country by the EU. it, like wales, is treated as a minor english county.

For this to change, the scots will have to all vote for the scottish national party, and since they all currently vote for the english labour party, this situation is unlikely to change in any hurry.

sorry to go off topic, but i only just saw this now..

Thymox 09-11-2002 05:49 PM

Thanks for the update, Calum. I didn't know that... probably because I don't really keep up to date with politics. 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.

neo77777 09-26-2002 09:31 PM

Here is another one from UGU, it is old but it is a bit funny
Code:

KILL A USER, IN THE UNIX SENSE

DISCLAIMER: UGU is not telling you to kill your users.
If you so choose to it is at your own discretion and you
are doing it at your own risk.
 
Although we all have that ONE USER...

To kill all the processes associated with a particular user
simply:

# kill -9 `ps -aef|grep jondoe |awk '{ print $2 }'` 

If you want to be a nice admin, tell him first.



All times are GMT -5. The time now is 08:20 AM.