Return to AskMe Archive Main Page
Return to Main PowerUsers.info Main Page
**********************************************************************PowerUsers.info - Paul Doherty Askme Archive of Questions and Answers
Category : Unix
QAId : 3231203
Asker : berhoomi
Subject : pick a line from another file
Private : No
Question : Hi,
I would like to know how to pick a line from another file. In other words, if I
have a file called A.txt and I'm running a shell programming that will pick the
first line from A.txt do some modification and then add it to file B.txt. Then
picks the second line, do the same modification and add it to B.txt. Each line
ends with a semicolon ";". The problem is how to pick line by line each time.
The shell program supposes to pick each line using a while loop
Answer : So you are reading from A.txt line by line, modifying each line in some
way and then sending those changed lines to a new file B.txt, right? Here is the
structure for that:
#!/usr/bin/ksh
cat A.txt | while read line
do
#modification stuff
# on each "line" go here
echo $line >> B.txt
done
That's it - so for example let's say you were going to read in all the lines of
A.txt and make all the characters in each line uppercase and output the results
to B.txt.
#!/usr/bin/ksh
cat A.txt | while read line
do
echo $line | tr "[:lower:]" "[:upper:]" >> testfile2
done
--
Paul Doherty, CNA, CNE, MCP+I, MCSE, A.A., B.A.
http://members.home.net/iqueue
Home of PC DiskMaster and other Windows utilities
Answer : In the last example that "testfile2" should be "B.txt" to fit the
example.
Rating : 5
----------------------------------------------------------------------
QAId : 3373769
Asker : Anonymous
Subject : write zero byte in unix
Private : No
Question : Anyone know the command to write every files (including and not
including the sub-directory) into zero byte under unix?
Answer : It sounds like you are trying to empty out files that already exist?
If so...
For the files in your current directory only:
ls | while read item
do
cat /dev/null > $item
done
For all the files in the current directory *and* all files in all
subdirectories:
find . | while read item
do
cat /dev/null > $item
done
--
Paul Doherty, CNA, CNE, MCP+I, MCSE, A.A., B.A.
http://members.home.net/iqueue
Home of PC DiskMaster and other Windows utilities
Rating : 4
Answer : Just curious... (3 stars) In what way did that *not* answer your
question?
FUQuestion : Even I wondered the 3 stars because I remembered I click on 5 stars
after testing. However, thank you very much for your help.
Answer : No problem... I feel better now. I had wondered how that could be
construed to be less than a "full" answer. Thanks for clearing it up.. :-)
--
Paul Doherty
http://members.home.net/iqueue
Rating : 4
----------------------------------------------------------------------
QAId : 3448592
Asker : i237
Subject : Complie
Private : Yes
Question : Hi,
I'm a begingner learnig unix and c.
I have a quesion,
how can I complie the c in unix.
for examplie ,
what command should I type to compile the hello.c
thanks in advance
Answer : Either:
cc hello.c
or
gcc hello.c
depending on which compiler you have installed. Do a:
which gcc
which cc
and see which gives you a response.
--
Paul Doherty
http://members.home.net/iqueue
Rating : 5
----------------------------------------------------------------------
QAId : 3483152
Asker : Anonymous
Subject : Sendmail
Private : No
Question : Dear pauldaherty,
Where i can get documentation or resource on how to configure/setup sendmail as
SMTP server.
Thanks
Answer : Did you try the main page for sendmail?
http://www.sendmail.org/
--
Paul Doherty
http://members.home.net/iqueue
Rating : 3
----------------------------------------------------------------------
QAId : 3739490
Asker : Anonymous
Subject : unix
Private : Yes
Question : is the Unix operating system's standard user interface, GUI, similar
to that of the Macintosh and windows system?
I just want to know if it is true or false, no explanation necessary
Annonymous - who gives generous ratings
Answer : They're as different (and as similar) as GUIs can be - they both have
mice, pointers, windows and menus, but beyond that they configuration and use of
them is as different as can be.
--
Paul Doherty
http://members.home.net/iqueue
Rating : 5
----------------------------------------------------------------------
QAId : 3761398
Asker : subirp
Subject : unix
Private : No
Question : I wanted to know if I can untar a file to a different location than
where the tar file is. The tar file does not have a absolute path. For instance:
# tar tvf dazel.tar
would install the following files under the
current directory. I do not have enough space to put the tar file
in the file system that I want to install the files in.
# tar tvf dazel.tar
rwxr-xr-x 2/2 163360 Jun 18 20:10 1998 dazel/repository/bin/lpr
rwxr-xr-x 2/2 376480 Jun 18 20:10 1998 dazel/repository/bin/mkoiddb
Answer : No problem - the tarfile will extract to where you are. So if the file
is in /tmp do this:
cd /whereever/you/wanttoextract
tar -xvf /tmp/myfile.tar
Paul Doherty
http://members.home.net/iqueue
Rating : 3.3
Rating : 3.3
Rating : 3.3
----------------------------------------------------------------------
QAId : 3793170
Asker : akkha
Subject : systems
Private : Yes
Question : Dear Sir/Madam
Can you tell me the different between networked systems and distributed systems?
ps. am i in the right category, if not pls tell me which category should i ask.
Thanks in advance
Answer : I would say the difference is that "networked" systems are ones who are
linked by networking hardware but may or may not have anything to do with each
other in a functional sense, whereas a "distributed" system is one that uses
multiple systems, connected by a network, to perform a particular function.
--
Paul Doherty
http://members.home.net/iqueue
----------------------------------------------------------------------
QAId : 4362683
Asker : aberjel
Subject : unix for x386
Private : No
Question : i'm intended to install unix on 80x386 computer
and so far as i know that there's just minix can be installed on such a machine
.
i want to know if there's any kinda of unix or unix like to install on it .
Answer : If by "x386" you mean an Intel processor machine running the X86
architecture (which includes 386, 486, Pentium, II, II, IV CPUs and more) you
may want to look at other UNIX-like offerings:
Linux:
http://www.redhat.com
http://www.suse.com
http://www.mandrake.com
http://www.linux.com
BeOS:
http://www.be.com/products/freebeos/
FreeBSD:
http://www.bsd.org/
--
Paul Doherty
http://members.home.net/iqueue
----------------------------------------------------------------------
QAId : 4381728
Asker : domenic_colantoni
Subject : Backup Command...
Private : Yes
Question : On digital Unix I use the vdump command to backup our filesystems.
(ie. were you get to input the level of backup to perform 0-9)
I understand there is a similar command for the Sun operating system...
Would you know what it is?
Thanks in advance
Domenic
Answer : I think the command you are looking for is ufsdump...
--
Paul Doherty
http://members.home.net/iqueue
Rating : 5
----------------------------------------------------------------------
QAId : 4384948
Asker : jatanag
Subject : how to start unix without keyboard
Private : No
Question : How can automatically reboot unix without keyboards.
Answer : One way...
Use
crontab -e
(be sure EDITOR is defined, as in EDITOR=/usr/bin/vi;export EDITOR)
and schedule a reboot for the time you want.
--
Paul Doherty
http://members.home.net/iqueue
----------------------------------------------------------------------
QAId : 4434633
Asker : john2069
Subject : Memory usage on Solaris 2.7
Private : No
Question : Does Solaris have a command that shows the memory usage for specific
processes?
I have a process that I suspect has a memory leak. When several of these
processes are running, memory appears to be used in increasing amounts.
Answer : Two ways:
ps -efyl | grep myprocess
OR
Use the 'top' utility which will show the top offenders in terms of resource
usage.
--
Paul Doherty
http://members.home.net/iqueue
Home of PC DiskMaster and DOS/Windows Utilities
Rating : 5
----------------------------------------------------------------------
QAId : 4676536
Asker : Anonymous
Subject : UNIX
Private : No
Question : where can i find comparison of how fast different operating systems
run at.UNIX,NT,Win9x,etc..
can't find it anywhere.And also how do i find out which file contain the ip
address of the server I am currently connected to in unix?
thx in advance
Answer : Try the command:
ifconfig -a
Speed tests of various operating systems:
http://www.google.com/search?q=speed+tests+solaris+windows+nt+linux
--
Paul Doherty
http://members.home.net/iqueue
Home of DOS/Windows Utilities
----------------------------------------------------------------------
QAId : 4765862
Asker : f.boies02017
Subject : Some commands
Private : No
Question : I'm a beginner in Unix, could you give me a help and tell me what
these commands are used for:
rm, rmdir, date, pwd, free, user, w, who, more, | (pipe), exit, reboot,
shutdown, mount, umount, find touch, logname, passwd, su and tar.
Thanks a lot
Christian
Answer : That is too many for me to detail here - it would take several pages of
typing to adequately explain all of those. Check here for people who already
have:
http://www.google.com/search?q=unix+commands+explanation+ls+mkdir+shutdown+rm
--
Paul Doherty
http://members.home.net/iqueue
DOS/Windows Utilities
Rating : 5
----------------------------------------------------------------------
QAId : 4789806
Asker : yannanqi
Subject : How to create a user that has the same UID as another user account?
Private : No
Question : pauldoherty,
I have a question about unix to trouble you.That is:
How to create a user using "useradd" command that has a UID same to another user
that already exists?
For example ,I have already created a user account "user_one",and its UID is
201.Now I want to create another user account "user_two",and its UID is also
201. I tried "# useradd -d /usr/user_two -u 201 user_two",but I failed.Can you
help me?
Thank you very much.
Answer : Just vi the two following files (as root) and copy and paste the lines
for the user you're attempting to duplicate, then change each occurrence of the
old name in the copied lines to the new user name:
/etc/passwd
/etc/shadow
Afterwards issue:
passwd newuser
where 'newuser' is the name of the duplicate user.
--
Paul Doherty
http://members.home.net/iqueue
Home of DOS/Windows Utilities
Rating : 5
----------------------------------------------------------------------
QAId : 4822711
Asker : Anonymous
Subject : how do i change the network settings in UNIX
Private : No
Question : I just started using UNIX last week and I need to change/add DNS #'s
to the Network Settings, but I cannot find out where or how to modify the
network settings. I'm using the OS Solaris 8.
any help would be Greatly appreciated.
Answer : You will need to edit these two files:
/etc/resolv.conf
/etc/nsswitch.conf
In nsswitch.conf find the line that has "hosts" at the beginning and make it
say:
hosts: files dns
In the resolv.conf (make it if it doesn't exist) you will need these lines:
domain blah.blah.com
nameserver ip_address_of_dns_server_1
nameserver ip_address_of_dns_server_2
search first.com second.com
The first.com and second.com indicate what domains should be searched
automatically when you type a name in - for example if a machine is named (in
DNS) machine1.first.com with the above lines in place you will successfully find
its IP address without using its fully-qualified name.
Fully-qualified name:
machine1.first.com
With the resolv.conf lines in place can be gotten as:
machine1
so both of these next lines would work:
ftp machine1.first.com
ftp machine1
--
Paul Doherty
http://members.home.net/iqueue
DOS/Windows Utilities
Rating : 5
----------------------------------------------------------------------
QAId : 4848780
Asker : Anonymous
Subject : unix editor
Private : No
Question : Hi All,
I noticed a user using their cursor keys while
editing scripts via vi. How is this possible?
Do I need to be in a different shell?
Do I need to set my environment prior to editing
vi?
Thanks in advance
Answer : I assume you mean they were using the cursor keys and such to edit *at
the command line* with vi commands? That is done by setting the appropriate
environment variables. I always set these two in my .profile file:
VISUAL=/usr/bin/vi;export VISUAL
EDITOR=/usr/bin/vi;export EDITOR
I also use ksh (Korn shell).
Thereafter you can treat the command line just like a vi session - hit ESC and
you're in command mode, and "i" for insert, "a" for append.
--
Paul Doherty
http://members.home.net/iqueue
DOS/Windows Utilities
Rating : 5
End :
----------------------------------------------------------------------
QAId : 4929290
Asker : thd1811
Subject : Preferred way for disk layout on Sun machine
Private : No
Question : I have been installing Solaris 7 on sun machines(Ultra10's 60's) and
wanted to know what is the preferred way to layout a disk. I usually have
autolayout do the initial and then customize from there. Some questions I had
are::
Why does it always put the minimum in the root / partition? Esp. if var isn't on
a different partition, then it usually runs out of space for patches.
Is there a good reason to put /opt, /usr/openwin, or /var on their own
partition?
Where does it get the amount for the swap space?
thanks,
Answer : I agree the default root is never adequate. I tend to isolate the /var
and /tmp (swap) filesystems and let root have the rest. I can see that putting
/opt and /usr in their own can be a good thing too though. It can make replacing
failed drives or adding space to them easier if they are not part of the root
filesystem.
I am not sure of the rule of thumb employed in choosing the size of swap (if
that was what you meant). I usually go for 1-2X RAM, whichever I can afford in
disk space.
--
Paul Doherty
http://members.home.net/iqueue
Home of DOS/Windows Utilities
Rating : 4
----------------------------------------------------------------------
QAId : 4961243
Asker : thd1811
Subject : How can I tell which shell I'm in??
Private : No
Question : How can I tell which shell I'm in??
I used to be able to just tell by the prompt whether it was %,#, but now we have
other shell variant like the tch, bash and zsh, is there a cmd that will tell me
exactly what shell I'm currently using? Thanks,
Thomas
Answer : echo $0
--
Paul Doherty
http://members.home.net/iqueue
Home of DOS/Windows Utilities
Rating : 3.9
Rating : 3.9
Answer : Well, what are you doing in csh??? hehe ;-)
FUQuestion : Yeah, I know, but some people here use it as their default shell, I
have to deal with everybody's preferences. :)
Answer : No answer required - :-)
----------------------------------------------------------------------
QAId : 4966062
Asker : yannanqi
Subject : Why "rsh" doesn't work?
Private : No
Question : Hi,pauldoherty.
I have a problem to ask for you:
By setting file .rhosts,I can use "rcp "command
to operate on remote host "host1" from "host2".
But when I use "rsh " command ,it gives error
messages as:"host1:host1 cann't open".
Can you solve the problem for me and tell me how
to execute some commands on remote host?
(host1: SCO OpenServer 5.0.5
host2: SCO OpenServer 5.0.5)
Thank you.
yannanqi.
Need More Information : "host1:host1" doesn't make sense to me in an rsh
command. Can you show me what your command looks like exactly?
It should appear like this:
firestone $ rsh lizard cat /etc/lizard.file >> firestone.file
This run on the system named firestone would have the effect of appending the
text in file /etc/lizard.file on the system named lizard to the file
firestone.file in the current directory on firestone.
For this to work without fully-qualified names you would need corresponding
entries in each machines /etc/hosts file for it to resolve the other's name.
--
Paul Doherty
http://members.home.net/iqueue
DOS/Windows Utilities
FUQuestion : All right.I will give you my cofinguration as below:
1.host1(remote host): IP:144.88.8.1 name:host1
/etc/hosts : 144.88.8.2 host2
...
/etc/hosts.equiv: host2
/usr/user1/.rhosts: host2
2.host2(local host): IP:144.88.8.2 name:host2
/etc/hosts: 144.88.8.1 host1
...
3.the command I executed on local host(host2) is:
$rsh host1 ls /tmp
4.the error message is:
host1:host1:can not open
Need More Information : Do you have /etc/nsswitch.conf configured to look to
"files" before dns?
What is in your /etc/hosts.deny and /etc/hosts.allow files?
Have you considered installing ssh and using it's programs instead (as a secure
alternative - ssh, scp slogin)?
http://www.ssh.org/faq.html
http://www.freessh.org
--
Paul Doherty
http://members.home.net/iqueue
DOS/Windows Utilities
FUQuestion : I didn't find files/etc/nsswitch.conf,/etc/hosts.deny and
/etc/hosts.allow.
What's ssh? What's its usage? Can you tell me something about it and where to
download it and how
to install it?
Thank you.
Answer : The links to the download and docs are in the message I sent you above.
After you install or compile/ionstall it ssh should be in /usr/local/bin and
consists of replacement utilities that do the same things as rcp/rsh/rlogin but
in an encrypted and secure manner.
The commands are scp/ssh/slogin - "secure" versions of the same-named commands.
To use them as a user simply inlcude /usr/local/bin in your PATH, make a .ssh
directory in your home dir (where the SSH connects to hosts configurations are
kept) and start connecting with other machines that have SSH installed.
--
Paul Doherty
http://members.home.net/iqueue
Home of DOS/Windows Utilities
FUQuestion : I download file "fressh-0.8.1.tar.bz2",how to uncom-
press it? It's not .Z file.
Rating : 5
Answer : You'll need bunzip2 (ensure you don't already have it - my Solaris 8
machine does):
http://www.google.com/search?q=bunzip2+bz2+download&hq=&hl=en&lr=&safe=off
--
Paul Doherty
http://members.home.net/iqueue
Home of DOS/Windows Utilities
----------------------------------------------------------------------
QAId : 5001680
Asker : hgil21
Subject : permmisions on files
Private : No
Question : hi ! How are you ? I got a question..
any files or directories like below with no permissions to users to read these
files. How can users know that how big these files are. Or what informations
users can have about these kind of files or directories. thanks
-rw-r----- 1 applmgr applmgr 74 Sep 28 1998 afiedt.buf
drwxr-x--- 2 applmgr applmgr 24 Sep 19 1999 core_21330
drwxr-x--- 4 applmgr applmgr 1024 Oct 6 1998 gar
drwxr-x--- 2 applmgr applmgr 1024 Sep 28 1998 sql
Answer : The file cannot be read or have its contents displayed by anyone not in
the applmgr group, or the applmgr account itself.
The directories cannot be entered by users unless you give "other" the read and
execute permissions, or they are a member of the applmgr group. In fact even if
you have files to which the user would normally have access (like read
permissions to a text file inside one of those directories) they will be unable
to examine those files if the directory permissions are set the way they are
above.
--
Paul Doherty
http://members.home.net/iqueue
DOS/Windows Utilities
Rating : 5
----------------------------------------------------------------------
QAId : 5006960
Asker : thd1811
Subject : /home directory question
Private : No
Question : I have this machine I took over from another admin
and it has a /home directory with a lot of other peoples account names in them,
they are large and thought I can delete them but it says permission denied even
though I'm logged in as root. I can't do anything with them, chmod, chown, etc.
what are these directories?
Answer : If you are root you can get rid of them. Try it this way - assume that
/home/user1 is the home directory a user named 'user1':
cd /home
rm -Rf user1
Be careful as the whole subdir branch will be gone.
Rating : 5
----------------------------------------------------------------------
QAId : 5006999
Asker : dreamlink
Subject : What i have to do to compress/uncompress a unix directory /test via
gzip or tar
Private : No
Question : What i have to do to compress/uncompress a unix directory (i.e.
/test) via telnt using gzip or tar ?
Thank you
Answer : If you have a file that looks like this:
file1.tar
it's just tarred and you can extract it like this (assume that file1.tar is in
your /home/user dir):
cd /tmp (or wherever you'd like the file extracted - can be the same dir as the
tar file)
tar -xvf file1.tar
If the file looks like this:
file1.tar.gz
it's been tarred and then compressed with gzip as you mentioned. To get it out
you can do this:
gunzip file1.tar.gz
tar -xvf file1.tar
OR if you have gzcat available you can leave the archive intact and get at the
insides like this:
gzcat file1.tar.gz | tar -xvf -
Also sometimes you may see files like:
file1.tar.Z
This file was tarred and then compressed with "compress" - to get at it:
uncompress file1.tar.Z
tar -xvf file1.tar
Paul Doherty
http://members.home.net/iqueue
Rating : 5
----------------------------------------------------------------------
QAId : 5021692
Asker : yannanqi
Subject : How to use SHELL variables in awk
Private : No
Question : Hi,pauldoherty.
I have a question to ask you,that is:
In awk,how to invoke shell environment varialbe?
For example,I want to merge environment variable
VAR1 and $1 of awk, I write the following wrong
command to express myself:
# awk '{print $VAR1,"-->",$1}' /etc/passwd
I know I can't simply use $VAR1 because awk has masked "$" by ' '.So what should
I do to let awk
not mask "$"?
Thank you.
yannanqi.
Answer : Here is a conversation thread on the topic:
http://groups.google.com/groups?hl=en&lr=&safe=off&th=84edbeac5a2ed140&start=0&ic=1
--
Paul Doherty
http://members.home.net/iqueue
DOS/Windows Utilities
Rating : 5
----------------------------------------------------------------------
QAId : 5033881
Asker : Anonymous
Subject : Questions about UNIX command
Private : No
Question : What's the difference between commands "print" and "echo"?
What's the usage of commands "cd ~", "cd -" and "cd ~-"?
Thanks for your attention!
Answer : Well print is an executable and echo is usually a shell built-in
function. print also accepts more parameters that modify it's functionality. See
"man print" and "man echo" for more details.
cd ~
means take me to the current user's home directory (does not work in all shells
- may be a Linux-ism in bash)
cd -
means take me to the last directory I was in
cd ~-
I've never heard of this one and since it equates to two paths at the same time
I'm not sure it's valid.
--
Paul Doherty
http://members.home.net/iqueue
DOS/Windows Utilities
Rating : 4
Rating : 4
----------------------------------------------------------------------
QAId : 5097087
Asker : Anonymous
Subject : compress all files and folders in a directory
Private : No
Question : Hi,
A quick question, how can i compress all files (including other folders) inside
a particular folder?
gzip myfile * -only works on files inside the current folder and does not
include folders
Thank you.
Answer : Try this (assuming you want to archive the /var/stuff directory and all
files/dirs beneath it):
cd /var/stuff
tar -cvpf ..\stuff.tar .
cd ..
gzip stuff.tar
Now you have a file called stuff.tar.gz that contains a compressed version of
all your subdirectory structure including all permissions. To retore it (to the
same or a different system) ensure the /var/stuff dir exists, then:
cd /path/to/archive
gunzip stuff.tar.gz
cd /var/stuff
tar -xvpf /path/to/archive/stuff.tar
And everything is back!
--
Paul Doherty
http://members.home.net/iqueue
Home of DOS/Windows Utilities
FUQuestion : The first command worked fine, but now i can't find the .tar file.
any ideas?
Answer : Oops - realized I have a backslash instead of a forward slash in the
tar command - change that from
tar -cvpf ..\stuff.tar .
to
tar -cvpf ../stuff.tar .
After the first two commands:
cd /var/stuff
tar -cvpf ../stuff.tar .
you will have created a 'stuff.tar' file in the directory above the one you're
in. (You can also tar to any other directory you like by using it in place of
"../" like /tmp/stuff.tar) That's where the next command:
cd ..
comes in - it moves you up one directory to where the file exists. then you
compress that file with:
gzip stuff.tar
and gzip compresses the file into stuff.tar.gz and deletes the original .tar
file.
--
Paul Doherty
http://members.home.net/iqueue
DOS/Windows Utilities
Rating : 4
----------------------------------------------------------------------
QAId : 5172809
Asker : p.kinsella@...
Subject : installing solaris 8
Private : No
Question : Hi,
I am trying to install solaris 8 on a sun microsystem ultra 10 elite 3D with two
hard drives. It lets me enter all the info and then tells me that the name
server is wrong it seems like its a hard drive problem.
heres the partition layout
o. c0t0d0 <seagate medalist 34342a cyl 8892 alt 2hd 15 sec 63>
/pci@1f,0/pci@1,1/ide@3/dad@0,0
1. c0t1d0 <ST34342A cyl 8892 alt 2hd 15 sec 63> pci@1f, 0/pci@1/ide@3/dad@1,0
heres the full map
part tag flag cylinders size blocks
0 unassigned wm 0 0 (0/0/0) 0
1 swap wu 0-1109 512.18Mb (1110/0/0) 1048950
2 backup wm 0-8891 4.01GB (8892/0/0) 8402940
3 unassigned wm 0 0 (0/0/0) 0
4 " " " " " "
5 " " " " " "
6 " " " " " "
7 " " " " " "
I'm not sure how to prepare the disk if it isn't prepared properly.
can you advise?
thanks
Pat
Answer : That is a known bug with Solaris 8's install. It will never succeed at
this point in the install if you select DNS. Just start a new install and select
"no name service" when asked. After the install add the DNS info you need in the
form of:
/etc/nsswitch.conf
/etc/resolv.conf
/etc/defaultdomain
/etc/hosts
--
Paul Doherty
http://members.home.net/iqueue
DOS/Windows Utilities
FUQuestion : Hi,
thanks for the info do i just edit these files and put in my ip addresses? And
finally
what book should i get if i want to be a solaris expert?
many many thanks
pat
Answer : Well it's a bit more than that. You'll need to find the line in
nsswitch.conf that looks like this:
hosts: files nis
and make it like this:
hosts: files dns nis
(and remove nis altogether if you like)
In resolv.conf you'll need this:
domain wherever.com
nameserver 214.24.38.32
nameserver 214.24.38.33
search wherever.com
In the above info you'll use your own DNS domain and name server addresses.
/etc/defaultdomain is just a text file with the domain name (same as in the file
above) in it.
/etc/hosts will contain information about any hosts (including your own machine)
that you need to know about even if DNS fails.
For example:
#
# Internet host table
#
127.0.0.1 localhost
10.1.1.9 elfstone elfstone.wherever.com loghost
"elfstone" is the local machine I am configuring.
Finally you will need a file called:
/etc/nodename.xxx
where 'xxx' is the device name for your interface card. You can find it by
typing:
ifconfig -a
"lo0" is the loopback device and can be ignored. We're after the other one -
like hme0, or le0. Once you determine which it is make the file as above and put
the hostname of your machine in it on a line by itself.
Reboot after this and you should be in business.
--
Paul Doherty
http://members.home.net/iqueue
Home of DOS/Windows Utilities
Rating : 5
----------------------------------------------------------------------
QAId : 5186526
Asker : takkie
Subject : RE: changing shells
Private : No
Question : Hi all
I am new to UNIX systems, and my professor told us to change our default login
shell to ksh (our default is bsh). He said there are 2 ways to do this. And i
figure it is changing the .profile by adding a line chsh ksh and at the prompt,
type chsh ksh. Now here is the probelm, how can i get back to bsh as my default
login shell??
i try to do chsh bsh but it says bsh is not an accceptable new shell. What
should i do??
2. I used ex to change the .profile file and add the line chsh ksh. I accidently
hit the backspace key and it came out ^H^H^H symbol. How can i delete those
characters?? it is now in my .profile file....what should i do??? I was using
telnet to do that....
please help.
@takkie
Answer : 1) I think you mean "bash" not "bsh".
2) Some terminals have screwy settings for the backspace key - usually pressing
CTRL-backspace or CTRL-DEL will get the effect you're after. You can change the
effect of the backspace key by typing this at a prompt:
stty erase (press the backspace key, then ENTER)
--
Paul Doherty
http://members.home.net/iqueue
Home of DOS/Windows Utilities
Rating : 4
----------------------------------------------------------------------
QAId : 5189608
Asker : eo
Subject : unix: how can I trigger a perl script to execute every 12 hours?
Private : No
Question : how can I trigger a perl script to execute every 12 hours?
linux environment, bash
Answer : Create the perl script with the first line appearing as:
#!/bin/perl
(assuming that after doing a "which perl" you get back /bin/perl for a path)
Then as whatever user you want this script ro run do a "crontab -e" and add this
line to the bottom:
0 0,12 * * * /path/to/script/myscript.pl
Save the file and it should now be run every 12 hours.
--
Paul Doherty
http://members.home.net/iqueue
Home of DOS/Windows Utilities
Rating : 3.9
Answer : And what exactly about this answer differs from the one you gave a
5-star rating to?
Rating : 3.9
----------------------------------------------------------------------
QAId : 5256757
Asker : takkie
Subject : RE: user prompts
Private : No
Question : hi all, please help!!
1. can i set up something like dos prompt in korn shell? what i mean by dos
prompt is whenever you are at a directory, it shows you where you are..for
example, for dos is 'c:/dir/2dir/3dir>" where 3dir is your current directory. If
you do a 'cd..' the prompt will look like this 'c:/dir/2dir>'...can i do the
samething with korn shell??? I want it to be like this: '$/usr/my-dir>' where
mydir is the current directory and samething like the dos example, do a cd..
will bring back to parent directory and the prompt will correspond with it.
2. can i do the samething like #1 using C-shell?
3. If you create a new.bat in dos, and you put the dos command in it. after you
save the new.bat, the next time you just have to type new.bat instead of typing
all the commands....can i do the samething with C-shell??? is there anywhere i
can create some files like a batch file using c-shell?
for example, i dont want to type 'ls -alf' all the time, i want to just type in
'newls' and it will execute 'ls -alf' for me. And i want to seperate the
commands with semi-colon instead of using the pipe operator. that is, 'newls;
newls2', where newls and newls2 is the batch file made in C-shell.
SOrry to bother you guys and please help!
@takkie
Answer : I use something like the following in /etc/profile to give all users
except root a custom prompt:
if [ "$LOGNAME" = "root" ];
then
PS1="# ";
else
PS1='[$LOGNAME@]'elfstone'] $PWD $ ';
fi;
export PS1
This will give a prompt like this:
[ped@]elfstone] /export/home/ped $
which will show the current directory as you move around. Move the pieces around
to make your own.
For csh try this one:
export PS1="$(uname -n)%($PWD)"
Make a directory under your home dir called "scripts" and then add that to your
PATH. Once you have that done you can add scripts to that dir and they will run
when you type them. To create the one you mentioned:
cd /export/home/myname/scripts
vi newls
(add the following)
#!/usr/bin/ksh
ls -alf $1 $2
Now do this:
chmod 755 newls
Now you can try the command.
--
Paul Doherty
http://members.home.net/iqueue
Home of DOS/Windows Utilities
Rating : 5
----------------------------------------------------------------------
QAId : 5263744
Asker : mmangano
Subject : Creating root equiv. accounts on Solaris 7
Private : No
Question : Hello,
I am having trouble figuring out how to create a root equivalent account under
Solaris 7.
Not sure what command to use?
Thanks,
Mark
Answer : Just edit the following files and copy the lines for the root user:
/etc/passwd
/etc/shadow
In the passwd file make sure you rename the "root" to the new username. Here is
the original line:
root:x:0:1:Super-User:/:/sbin/sh
Changed to the new one:
goober:x:0:1:Super-User Also:/:/sbin/sh
Here is original root line from the shadow file:
root:3KOV5gH3JFzkY:10528::::::
and the changed one:
goober:3KOV5gH3JFzkY:10528::::::
Now while you are still root do a:
passwd goober
and give him a new password (preferably a GOOD one since he's root-equivalent).
--
Paul Doherty
http://members.home.net/iqueue
DOS/Windows Utilities
Rating : 5
----------------------------------------------------------------------
QAId : 5274304
Asker : rube2
Subject : Changing IP on hme1
Private : No
Question : Hi, Paul!
I inherited a Sun220R to admin. IPv4 on Solaris8. It has 2
ethernet interfaces set to local 'reserved network' static IP numbers. I'm being
asked to put this machine on the outside of the firewall temporarily for
testing. I can plug it into a hub for this purpose. I have an external IP
number, netmask (not in hex though), and gateway router to point to for the hme1
interface.
'ifconfig -a' shows me the IP, netmask etc. I can 'ifconfig hme0 down' to take
down temporarily the primary interface.
How do I change the address of the hme1 interface? What commands must be invoked
to change the address so that I can then unplug it from the internal switch and
plug it into the external hub? Do I have to reboot the 220R for this to change?
Can't seem to find a straight answer on Sun's BigAdmin.
Ultimately, I'd like to make this machine a multihomed host - hme0 live to the
inside and hme1 live to the outside. There should be no packet forwarding
between interfaces and I don't want this to be a router, but then this machine
would be available for testing by engineers.
If you can help, thanks!
(please cc reply to kenzo562@iname.com if possible...)
Answer : You won't need a reboot - you just need some more ifconfig commands. To
change the IP of an interface do it like this:
ifconfig hme1 123.12.13.14 netmask 255.255.255.240 up
Make sure your default router (gateway/router port) is defined on a single line
in /etc/defaultrouter and that your netmasks are defined in /etc/netmasks.
To stop the machine from routing you only need to do this:
touch /etc/notrouter
and reboot.
To be really sure it doesn't get turned on disable the routed daemon in
/etc/inet/services.
--
Paul Doherty
http://members.home.net/iqueue
Home of DOS/Windows Utilities
Rating : 5
FUQuestion : Thanks for your quick response!
In /etc/netmasks, I have the original
<subnet> <netmask> in place:
172.16.0.0 255.255.255.0
Do I add the lines of the outside network right under the lines of the internal
network as part ofthe process of moving the machine outside of the private
network? That would be:
63.81.163.xxx 255.255.255.240
About /etc/defaultrouter: Is running:
# /usr/sbin/route add default 63.81.163.yyy 1
....the way to add a line in /etc/defaultrouter?
Thanks!
Answer : Yes just add lines as needed to /etc/netmasks for each network
interface. Follow the same format as the line you quoted. Your new line would
then be (if that was indeed your network and subnet mask):
63.81.163.0 255.255.255.240
Any access to a 63.81.163.0 address, or any interface that talks on a network
listed in netmasks, will be assumed to use that netmask unless overridden by an
ifconfig statement later.
I don't think you will want to be running route statements after disabling the
routed daemon and touching the /etc/notrouter file. Just create a single line
text file /etc/defaultrouter that has the IP of the interface you want to go to
as your default. So for instance it might be:
63.81.163.1
--
Paul Doherty
http://members.home.net/iqueue
Home of DOS/Windows Utilities
FUQuestion : Thanks Paul!
Turns out that the ethernet interface on the motherboard is multihomed with two
internal addresses.
I shut down both, detached the wire from the internal switch and attached it to
the external hub, assigned hme1 the external address and it was pingable from
the outside. I did not change the defaultrouter content which is an internal
address but it still worked. Can defaultrouter have two lines with unique
addresses?
In the future, I'd like to remain connected externally and use the second
physical interface connected internally but I don't want the fat pipe from the
external thru the CPU to the internal. Will turning off packet forwarding
accomplish this or is it just too dangerous once the CPU is penetrated?
Answer : Yes, just add extra lines for the backup default routes to
defaultrouter and you're set.
As for packet-forwarding. Yes I'd lock that machine down if it's going to stay
exposed to the internet at large. Unless this machine will be a firewall (in
which case it pretty much needs to route :-) I'd leave routing disabled - and if
someone does hack into it you're still at risk since they can potentially change
the configuration and get into the internal network if you have it plugged into
an ethernet cable.
--
Paul Doherty
http://members.home.net/iqueue
Home of DOS/Windows Utilities
Rating : 5
----------------------------------------------------------------------
QAId : 5294335
Asker : medawson
Subject : From One so-called Expert to another
Private : No
Question : I've been an expert on this site for almost a
year now. I've been wondering if anyone has
reaped any benefits from having joined the site
as an Expert (besides the "there's more happiness
in giving than there is in receiving" rule).
I've asked this of the Experts about a year ago,
and am curious to see if things have changed any
in that span of time.
It's getting kinda difficult to keep up with so
many questions at a time, especially when the
number of people who choose you as a favorite
continues to rise each month (up to 17 now).
I'd look forward to hearing the experiences of
others on this site. Thanks in advance.
Mark E. Dawson, Jr.
Collective Technologies
Senior Unix/Oracle Consultant
http://www.colltech.com
Answer : I've been answering questions on here since Jan or Feb 2000.
The benefits I've reaped (besides winning cash and t-shirts several times) are
mostly from knowing I've helped other people with questions they might not have
been able to answer otherwise. I like to share what I know with others since I'd
be appreciative if they'd do the same for me (I've asked several questions on
Askme.com myself). The other benefit is that by answering other people's
questions it helps you to stay sharp on the topics that interest you. It also
can make an excellent bullet point on a resume for potential employers who can
easily see the volume of effort you've put into a voluntary activity helping
others over a long period of time. That and for IT folks if they need to verify
your technical or writing ability they have reams of evidence (I'm up to 2,324
questions answered) so it's good from that standpoint as well.
--
Paul Doherty
http://members.home.net/iqueue
DOS/Windows Utilities
Rating : 5
Rating : 5
----------------------------------------------------------------------
QAId : 5341090
Asker : divya66
Subject : virtual address
Private : No
Question :
What is a virtual address space ?
Answer : That would likely be a reference to virtual memory or the mapping of
hardware locations into the memory map. Virtual memory is the technique of
mapping disk space into the RAM memory map to make the system appear to have
more RAM that it actually does. This makes the running of more apps
(multitasking) feasible on even modeest hardware. As for the hardware device
mapping connotation:
When data is being sent to a hardware device like a sound card the system
actually routes that data to an address in the main memory map. The sound card's
I/O (Input/Output) address was mapped into the system's memory range just before
boot-time and any data directed at that area of memory is actually being
delivered to the sound card.
Paul Doherty
http://members.home.net/iqueue
Rating : 5
----------------------------------------------------------------------
QAId : 5341149
Asker : divya66
Subject : hard/soft links
Private : Yes
Question :
what do we mean by saying Hard link and Soft link
( file system in unix) ?
Answer : The filing system uses a construct called an "inode" to keep
information about the file, including ownership rights and location on the
storage device.
A hard link is when you make a new name for an existing file that points to the
same location on disk as the original hard link (a hard link is automatically
made when you create a file). They both point to the same exact file so when you
make a change to one of them they both get changed. If you delete one of the
hard links (the new one or the original one) the file is still accessible by the
other and the file doesn't actually go away until all hard links are removed.
For example to make a hard link of your /etc/hosts file:
cd /etc
ls -l hosts
(note the number at the left (should be a 1) that indicates the number of hard
links this file has)
ln /etc/hosts ./hosts2
Now do another ls -l hosts and note that the number has changed.
A soft link is different. It too represents the file you point it at, but
instead it is a separate file that is a redirector. Anyone who comes looking for
the symlink name is redirected to the file you linked to. Removing the symlink
does not effect the original file.
To create a symlink of /etc/hosts:
cd /tmp
ln -s /etc/hosts ./myhosts
Now if you:
vi /tmp/myhosts
you will be editing the /etc/hosts file since you get redirected to it.
--
Paul Doherty
http://members.home.net/iqueue
Home of DOS/Windows Utilities
P.S.
Please do not ask questions in private if they are not of a private nature. This
is a general question, and not of an embarrassing nature. Marking it as private
detracts from the value of our interaction to others as they cannot read it
under any circumstance.
Rating : 5
----------------------------------------------------------------------
QAId : 5398013
Asker : a2rowe
Subject : unix
Private : No
Question : Hi,
i would like a unix script that greps for a process and if the process does not
exist to email me. I have a script that will email me. so basicly i think i need
an if else statement i think.
if the grep returns null (no result) do nothing
else
run email script
my programming i pretty weak
can you please help
many thanks
Answer : Ok here's what to do if the process you're looking for is called
"stuff":
#!/usr/bin/ksh
ps -ef | grep " stuff" > /tmp/tmpout
if [ ! -s /tmp/tmpout ] ;
then
# we didn't find the process so send email here ;
endif
--
Paul Doherty
http://members.home.net/iqueue
DOS/Windows Utilities
FUQuestion : hi,
thanks for your quick responce.
i get an error message!
script
#!/sbin/sh
ps -ef | grep "wget" > /home/user/tmpout
if [ ! -s /home/user/tmpout ] ;
then
# we didn't find the process so send email here ;
ps -ef | grep wget | /opt/bin/pmail.pl -s 'wget' bob@bob.com
endif
using ksh shell
./grepwget[4]: syntax error at line 5 : `then' unmatched
using sh shell
./script: syntax error at line 9: `end of file' unexpected
can you please help?
Answer : First thing is you didn't use ksh like I did - you included the line:
#!/sbin/sh
instead of mine:
#!/usr/bin/ksh
You don't need to change shells to run the script - just change the line above
and run it (using the path to your ksh or sh binary) - it will invoke the shell
to interpet the script (that's what the first line is for).
You also need a semicolon (;) like mine at the end of your emailing line. You
also need one after the "endif" which I neglected to add.
--
Paul Doherty
http://members.home.net/iqueue
DOS/Windows Utilities
Rating : 3
----------------------------------------------------------------------
QAId : 5509521
Asker : cindy_lens
Subject : mail
Private : No
Question : On Solaris, I entered this command "mail cindy@localhome.com <
"filename"
It works ok. Now, I would like to enter a subject when mailing this file, but
cannot figure out how.
Thank you, Cindy
Answer : mailx -s "Check this out!" email@home.com < /wherever/filename
Paul Doherty, CNE, MCP+I, MCSE, CCSA, CCSE
http://members.home.net/iqueue
Home of DOS/Windows Free Utilities
Rating : 5
----------------------------------------------------------------------
QAId : 5567551
Asker : salihasheriff
Subject : UNIX - AIX
Private : No
Question : In Unix - Vi editor how to move the cursor from end of the line to
begining of the line. What is the command to be used?
Thanks in advance
Answer : Press "0" (zero) to move to the beginning of a line, and "$" to move to
the end.
--
Paul Doherty
http://members.home.net/iqueue
Home of PC DiskMaster and other Windows utilities
Rating : 5
----------------------------------------------------------------------
QAId : 5653928
Asker : abdulq
Subject : Unix - Sun. Redirecting Output both to Screen and File
Private : No
Question : Hi,
How can I redirect output of commands or scripts both to screen and file? For
future record, I like to redirect output to Files but then I cannot see the
results till the execution of scripts is complete. Is there a way I can do both.
Examples:
1) ./run_script > ./logs/script.log
2) tar -tvf /dev/rmt/0 > ./tar_list.txt
3) tar -cvf /dev/rmt/0 /u01 /export/home
1> ./tar_output 2> ./tar_error
I am using Sun Solaris 2.5.1
Answer : Try the "tee" command. It will send the output along as well as
redirect it to a file.
--
Paul Doherty
http://members.home.net/iqueue
DOS/Windows Utilities
----------------------------------------------------------------------
QAId : 5685813
Asker : amit_kapila
Subject : how do I write a korn script to ftp files from one server to another
Private : No
Question : how do I write a korn script to ftp files from one server to another
Answer : Here is an example of a ksh script to do just that:
#!/usr/bin/ksh
# for auto FTP to work you will need a chmod 600 file in the originating user's
dir
# with the following line (.netrc file):
# machine mymachine.wherever.com login myusername password mypassword
ftp mymachine.wherever.com 1>/dev/null <<!EOF
bin
lcd /var/log/
cd log
put myfile.tar.gz
bye
!EOF
--
Paul Doherty
http://members.home.net/iqueue
DOS/Windows Utilities
Rating : 3.9
Rating : 3.9
----------------------------------------------------------------------
QAId : 5685826
Asker : salihasheriff
Subject : UNIX - AIX
Private : No
Question : Can I install UNIX/Linux in my PC which has already dual operations
system ie., Windows 98 and Windows NT 4.0
Please suggest me.
Thanks in advance
Answer : I'm not sure where AIX comes into this, but yes you should have no
trouble with adding Linux after-the-fact. It will replace the MBR with it's own
and offer you a choice on booting - if you choose 'Windows' it will then offer
you the same menu you're getting now (where you choose between NT and 98).
--
Paul Doherty
http://members.home.net/iqueue
DOS/Windows Utilities
Rating : 4.6
Rating : 4.6
----------------------------------------------------------------------
QAId : 5729300
Asker : petemcevoy
Subject : pop3 account setup
Private : No
Question : Hi,
I need to set up quite a few accounts on my hosts pop3 server, unfortunately
their web front end is pitifully slow and it would take me far too long long to
administer them all from there.I was wondering if I could telnet to port 110 of
the server, login and add the accounts myself from the command line, if this is
possible could you tell me the commands i would need (the only ones i know at
the moment are user,pass and dele!!) or point me to a resource on the web where
i could find this information.
Thanks for your time
Answer : I don't believe the POP3 standard interface will offer the ability to
create accounts. It will likely only allow manipulation of the accounts (and
their mail) that already exist.
http://pages.prodigy.net/michael_santovec/pop3telnet.htm
--
Paul Doherty
http://members.home.net/iqueue
DOS/Windows Utilities
Rating : 5
----------------------------------------------------------------------
QAId : 5745779
Asker : collinl
Subject : UNIX: Protect Dir from World
Private : No
Question : I have some data files in a directory on my Web server that I want to
prevent the public from viewing. However, that directory needs to be accesses by
other CGI scripts on my server. Is there any way to do that? Will chown and
chgrp do the trick? If yes, how? Thanks!
Answer : I would try making the user that owns the www/CGI processes the owner
of that subdirectory tree, and limit access to only that user. If the directory
was /usr/www
cd /usr/www
chown www:www .
chown -R www:www ./*
(assumes you have a 'www' user and group)
Then you would want to change the permissions of the files:
chmod go-rwx .
chmod -R go-rwx ./*
Now try an 'ls -al' from there and make sure all the rights are revoked for
group and other.
--
Paul Doherty
http://members.home.net/iqueue
DOS/Windows Utilities
Rating : 4
----------------------------------------------------------------------
QAId : 5751095
Asker : kalrapuneet
Subject : Shell Programming
Private : Yes
Question : Hi,
I have to write a shell program to display an employee's information for a
company. A part of my program is to count and display the number of working
hours in any given month of a year 2001. I am really stuck in this part. I would
be very grateful if you could help me.
Thanx,
P K
Answer : Here are a bunch of discussions about the topic. Click each you want to
see and then click "View complete thread" at the top-right to see all of the
messages in that thread.
--
Paul Doherty
http://members.home.net/iqueue
DOS/Windows Utilities
----------------------------------------------------------------------
QAId : 5882936
Asker : hgil21
Subject : unix
Private : No
Question : hi how are you ??
I work as a junior sys adm. and
I am on a project to write a shell script "to copy raw devices from one server
to other server". Can you give me conceptual idea to begin with.
Need More Information : Do you mean backup a raw device? Or do you mean create
the same raw devices on another machine?
FUQuestion : to copy raw devices from one machine ( production) to another (
some applications). They need it so they can have another machine for users to
decrease the load on production machine.
Answer : Look into the 'mknod' utility. Most of these devices are created
automatically by the system, I believe, but I think it would be the app involved
if you needed to make one manually.
--
Paul Doherty
http://members.home.net/iqueue
DOS/Windows Utilities
Rating : 5
----------------------------------------------------------------------
QAId : 5894564
Asker : Anonymous
Subject : Unix & smart calculator
Private : Yes
Question : The following are the script for a smart calculator. I've tried to
compile, but it didn't run. Pls help me to correct the script!
echo "Enter a number: \c"
read num1
echo "Enter another number: \c"
read num2
echo "Enter an operator (+,-,/,*,%): \c"
read oper
if [ $oper = + ]
then x = 0
x = `expr $num1 + $num2`
echo "The output is: \c" $x
elif [ $oper = - ]
then x = 0
x = `expr $num1 - $num2`
echo "The output is: \c" $x
elif [ $oper = / ]
then x = 0
x = `expr $num1 \/ $num2`
echo "The output is: \c" $x
elif [ $oper = * ]
then x = 0
x = `expr $num1 \* $num2`
echo "The output is: \c" $x
elif [ $oper = % ]
then x = 0
x = `expr $num1 \% $num2`
echo "The output is: \c" $x
else
echo "invalid input!"
fi
Answer : OK here you go:
#!/usr/bin/ksh
echo "Enter a number: \c"
read num1
echo "Enter an operator (+,-,/,*,%): \c"
read oper
echo "Enter another number: \c"
read num2
if [ $oper = + ]
then
x=`expr $num1 + $num2`
echo "$num1 $oper $num2 = $x"
elif [ $oper = - ]
then
x=`expr $num1 - $num2`
echo "$num1 $oper $num2 = $x"
elif [ $oper = / ]
then
x=`expr $num1 \/ $num2`
echo "$num1 $oper $num2 = $x"
elif [ $oper = * ]
then
x=`expr $num1 \* $num2`
echo "$num1 $oper $num2 = $x"
elif [ $oper = % ]
then
x=`expr $num1 \% $num2`
echo "$num1 $oper $num2 = $x"
else
echo "invalid input!"
fi
The only thing this doesn't work on is the multiplication. I think the asterisk
gives it fits and may need to be escaped or handled in some other way.
--
Paul Doherty
http://members.home.net/iqueue
DOS/Windows Utilities
----------------------------------------------------------------------
QAId : 5937848
Asker : Anonymous
Subject : Unix Bourne Shell programming
Private : Yes
Question : I need to develop a program which accepts a number which is non-zero
and not greater than the number of files in the current directory. The program
should then display the file name, permissions and size for that file number (in
that order). If there are 10 files in the directory and the number entered is 6,
the program should display the specified details for the 6th file.
Could U please correct my script?! Thanks!
Here's my script:
#!/bin/sh
ls -1|sort
totalfile=`ls -1|wc -w`
echo "there is $totalfile file(s) in `pwd` directory"
echo "Please enter filaname number : \c"
read fnumber
if [ $fnumber -eq 0 -o $fnumber -gt $totalfile" ]
then
echo "The number you enter is larger than $totalfile or zero"
exit 1
fi
fnumber=`expr $fnumber + 1`
temp=`ls -l|sed -n "$fnumber" 'p'`
filename=`echo $temp|awk '{print $9}'`
permission=`echo $temp|awk '{print $1}'`
size=`echo $temp|awk '{print $5}'`
echo "Filename : $filename "
echo "Access permission : $permission"
echo "File size (in bytes) : $size"
Answer : Here you go:
#!/usr/bin/ksh
ls -1|sort
totalfile=`ls -1|wc -w`
echo "there is $totalfile file(s) in `pwd` directory"
echo "Please enter filaname number : \c"
read fnumber
if [ $fnumber -eq 0 -o $fnumber -gt $totalfile ]
then
echo "The number you enter is larger than $totalfile or zero"
exit 1
fi
temp=`ls -1|sed -n "$fnumber"'p'`
echo VALUE of temp is $temp
filename=`ls $temp`
permission=`ls -l $temp | awk '{print $1}'`
size=`ls -l $temp|awk '{print $5}'`
echo "Filename : $filename "
echo "Access permission : $permission"
echo "File size (in bytes) : $size"
--
Paul Doherty
http://members.home.net/iqueue
DOS/Windows Utilities
----------------------------------------------------------------------
QAId : 5951294
Asker : hive42
Subject : chmod
Private : No
Question : i am trying to figure out how touse chmod to change permissions of an
executable so it is actually executable by me
i am the owner and i would like read write and execute acess to my file
i have tried reading the man pages but i can't quite figure out what flags to
use and how to pass it the file name
any examples would be most helpful
thanks
Laura
Answer : Just type:
chmod u+x file
to give yourself ("user" who is the owner of the file listed in an 'ls -l'
command) execute permission. To change other attributes:
chmod u-w file
would remove write permission for the user (owner) from 'file'.
chmod ug+rx
would add read and execute permissions for user and group (group owner listed in
an 'ls -l' command).
The numeric method mentioned by another expert is what I usually use. It's very
easy:
R W X
4 2 1
A "read" permission is worth 4 points
A "write" permission is worth 2 points
An "execute" permission is worth 1 point
So to change the permissions of any file to be what you want give the
permissions you want and add the numbers up for the permissions you chose. For
example:
I want to give the owner of the file full access, the group owner read and
execute permissions only, and "other" no permissions at all ("other", BTW,
simply means anyone who is not the actual owner of the file (user) or a member
of the group that shares ownership (group)).
Since I want full permissions for owner the first number will be all rights
added together:
user:
R + W + X
4 + 2 + 1 = 7
So we'll use a 7 in the first position for the owner's rights.
Now we want read and execute for the group owner:
group:
R + X
4 + 1 = 5
So we'll use a 5 in the second position for the group's rights.
Finally we want no rights for other:
other:
no rights = 0
So our chmod command is simply this:
chmod 750 file
which gives our user full rights, our group read and execute, and grants "other"
no rights at all.
--
Paul Doherty
http://members.home.net/iqueue
DOS/Windows Utilities
Rating : 5
Rating : 5
----------------------------------------------------------------------
QAId : 5951310
Asker : Anonymous
Subject : How can i know the size of a directory in Sun Solaris 7 ?
Private : No
Question : How can i know the size of a directory in megabyts under Sun Solaris
7 ?
thank you for your time ?
Answer : I always just cd into the directory to check and do a:
du -k
The total at the bottom is the total amount (in K) that the directory is using.
--
Paul Doherty
http://members.home.net/iqueue
DOS/Windows Utilities
----------------------------------------------------------------------
QAId : 6007084
Asker : a2rowe
Subject : unix
Private : No
Question : hi,
is there a command in unix to delete the first file lines in a file with out
using a text editor?
many thanks
Answer : You can do it like this:
cat file | tail +4l >> newfile
mv newfile file
The above would create a new file called 'newfile' that contains all the lines
except the first four from 'file'. The second line copies it back over the
original.
--
Paul Doherty
http://members.home.net/iqueue
DOS/Windows Utilities
Rating : 4.9
Rating : 4.9
----------------------------------------------------------------------
QAId : 6134949
Asker : peichun28
Subject : "cat" command
Private : No
Question : Hi! I face the problem and hope can get some assist from your.
Currently, my working environment have 2 Sun Server :
Assume :
Svr1 - IP Address : 199.1.1.1
Svr2 - IP Address : 199.1.1.2
At Svr1 : I have one file call file1
At Svr2 : I have one file call file2
Now, at Svr1 I need to combine the file1 (Svr1) and file2 (Svr2)
Last time the file is at same server so I just have to use the “cat” command
then solved the problem ?
But now the file is at different server so is there any methods can combine this
two file ? (beside FTP over the file from Svr2)
Can the "cat" command combine two file from different server ?
Thanks !
Answer : If you have ssh installed (comes with ssh, scp, and slogin commands -
usually stored at /usr/local/bin) you can try it this way:
on Svr1:
echo `ssh svr2-ip-address:cat /whereever/file2` >> file1
Those are backticks (`) above.
--
Paul Doherty
http://members.home.net/iqueue
DOS/Windows Utilities
----------------------------------------------------------------------
QAId : 6134981
Asker : peichun28
Subject : "cat" command
Private : No
Question : Hi! I face the problem and hope can get some assist from your.
Currently, my working environment have 2 Sun Server :
Assume :
Svr1 - IP Address : 199.1.1.1
Svr2 - IP Address : 199.1.1.2
At Svr1 : I have one file call file1
At Svr2 : I have one file call file2
Now, at Svr1 I need to combine the file1 (Svr1) and file2 (Svr2)
Last time the file is at same server so I just have to use the “cat” command
then solved the problem ?
But now the file is at different server so is there any methods can combine this
two file ? (beside FTP over the file from Svr2)
Can the "cat" command combine two file from different server ?
Thanks !
Answer : If you have ssh installed (comes with ssh, slogin, and scp commands)
you can try something like this:
Executed on Svr1:
echo `ssh Svr2_IP_Address:cat /whereever/file2` >> file1
This will use ssh (secure shell) to execute a cat command inside the backtick
quotes on the remote system. The cat command will spit the contents of file2 and
return it to file1 from standard input (STDIN). The echo command will then send
that output in a concatenate command (>>) and add it to the end of file1. In the
end file1 should contain the contents of file1, followed by file2.
--
Paul Doherty
http://members.home.net/iqueue
DOS/Windows Utilities
Rating : 4
----------------------------------------------------------------------
QAId : 6180933
Asker : dan.burke@...
Subject : What to know?
Private : No
Question : I am currently in the US air force as a Unix Admin SV4. But on our
end we are just endpoint admins. I do weekly backups, add/del new users & look
over Security/GW status reports for the system, and also installed a stand alone
Solaris 8 machine that I mess around with, but we don't have full controll of
the system. I'm more like a Unix Database Admin. I also work with Oracle HR & NT
machines, but they also are limited access to the whole system. When it comes to
going for an interview I have no idea what kind of questions will come up & do I
actually have the whole experience to be a Unix Admin on the outside by not
dealing with the whole system?
Basically, what are important factors & knowledge that employers look for in a
Unix admin, and what could I do or study in the next year to be ready? Thanks.
DAN
Answer : It's kind of hard to say - you need to be able to think in the UNIX
mindset, so to speak. Once you can think that way (understand the differences
between, say, Windows and UNIX) then here are some other items of importance:
UNIX commands (ls, cp, cat, tar, etc...)
startup/shutdown scripts
backup/restore
disk layout/partitioning/mirroring/RAID
programming (scripts/Perl)
hardware additions (how to add/remove)
mounting devices (CD-ROM, floppy)
configuring the user environment - login scripts (.profile), environment
variables, etc
creating/removing accounts (useradd, etc)
changing passwords
permissions and how to modify (chown/chgrp/chmod)
Those are some of the important things I can think of off the top of my head.
Starting with these will certainly lead to some more.
Best of luck!
--
Paul Doherty
http://members.home.net/iqueue
DOS/Windows Utilities
----------------------------------------------------------------------
QAId : 6222656
Asker : subirp
Subject : Copying Dire. from CDROM
Private : No
Question : Hi,
As root, I copied using "cp -p -R /SD_CDROM /cd2"
the entire directory structure from a CD (/SD_CDROM is the CD mounted file
system) in Hp-ux
to another filesystem (/cd2)on the same server.
My question:
How come when I do a du -ks on one of the sub
dire. in separate file systems they reveal diff. size (I was expecting
everything the same)? Am i missing a file or two ?
How come no. (ex. below revealed
1024 for one direc. and 4096 for another.) ?
And what are these numbers. ? Dir. Size ?
========================
# pwd
/cd2/SD_CDROM/stage/Components
# ls -l
dr-xr-xr-x 2 25882 502 1024 Sep 22 2000 DataFiles
# du -ks DataFiles
10628 DataFiles
=======================================
# pwd
/SD_CDROM/stage/Components
dr-xr-xr-x 2 25882 502 4096 Sep 22 2000 DataFiles
# du -ks DataFiles
10631 DataFiles
Answer : You are likely seeing the difference in allocation units per device.
This is the cause of what is commonly referred to as "slack space". Every device
that can store data has a smallest addressable element it can write data to,
similar to an atom (or quark) being the smallest unit of matter. No file can be
smaller than this smallest unit unless compression is involved (where a file
spans multiple units). So all you are seeing is that in one case the cluster
size is 1K (1024 bytes) and in the other it's 4K (4096 bytes).
To ensure you got all the files you can redirect the output from a find to files
and then diff them:
cd /cd2
find . > /tmp/a
cd /SD_CDROM
find . > /tmp/b
cd /tmp
diff a b > c
more c
OR you could count the files and dirs using this type of construct:
cd /cd2
find . | wc -l
cd /SD_CDROM
find . | wc -l
and ensure the count was the same.
--
Paul Doherty
http://members.home.net/iqueue
DOS/Windows Utilities
Rating : 5
----------------------------------------------------------------------
QAId : 6228507
Asker : aserebry
Subject : bcp
Private : No
Question : What is comand 'bcp' stand for, what it does and what is the basic
syntax of using this command.
thanks in advance!
Answer : It's the "bulk copy command" and appears to be a Sybase utility.
The syntax is here:
http://manuals.sybase.com/onlinebooks/group-as/asg1250e/util/@Generic__BookTextView/3467
(click the small "bcp" link at the top for the exhaustive syntax)
--
Paul Doherty
http://members.home.net/iqueue
DOS/Windows Utilities
Rating : 5
----------------------------------------------------------------------
QAId : 6304446
Asker : hpchua
Subject : Solaris 7 Sys Admin Test Guide
Private : No
Question : Hi folks,
Has anyone of you guys have a study guide for Solaris 7 System Administartion,
Volume I? Can I have a question and answer for you guys who had been seated for
Solaris 7 System Admin I (310-009) test? Now, I'm trying to get as many question
as possible so that I have enough practises before seat for the exam.
Thanks in advanced!
Answer : Try these exam cram study sheets:
http://cramsession.brainbuzz.com/cramsession/Sun/
--
Paul Doherty
http://members.home.net/iqueue
DOS/Windows Utilities
Rating : 4
----------------------------------------------------------------------
QAId : 6304495
Asker : Anonymous
Subject : Solaris naming services
Private : No
Question : What is and where is or how do i find the file that Solaris uses to
determine what naming services it should use?
Answer : There are two files you need:
/etc/nsswitch.conf
and
/etc/resolv.conf
In nsswitch.conf you will have something similar to this:
#
# /etc/nsswitch.files:
#
# An example file that could be copied over to /etc/nsswitch.conf; it
# does not use any naming service.
#
# "hosts:" and "services:" in this file are used only if the
# /etc/netconfig file has a "-" for nametoaddr_libs of "inet" transports.
passwd: files
group: files
hosts: files dns
ipnodes: files
networks: files
protocols: files
rpc: files
ethers: files
netmasks: files
bootparams: files
publickey: files
(lines truncated)
The important line to note is the one for "hosts:" - that is the line that
determines what services, and in what order, should be consulted to resolve
hostnames. It should be set to "files dns" as above unless you're using NIS.
The resolv.conf file will appear similar to this:
domain myco.com
nameserver 15.19.9.20
nameserver 15.19.9.21
search myco.com
Here you put your local DNS domain you reside in, the IPs of each DNS server you
need, and the search domain(s) you want truncated to bare hostnames when
performing a search for resolution (keeps you from having to type
mywebserver.myco.com - you can just type mywebserver and it will append if
needed).
--
Paul Doherty
http://members.home.net/iqueue
DOS/Windows Utilities
----------------------------------------------------------------------
QAId : 6304508
Asker : mshetty224
Subject : Read a string from output stream
Private : No
Question : Hi,
We are trying to read a string ("Password") output by a utility using Java on
Unix. Reading the output stream returns a -1.
Thanks and Regards,
Mranalini
Answer : Try reading both STDOUT *and* STDERR. You may only be getting STDOUT
and the utility may only send a return code there.
javautil 1>/tmp/a 2>&1
This (if using sh or ksh) will send the output of both to a file called /tmp/a.
--
Paul Doherty
http://members.home.net/iqueue
DOS/Windows Utilities
Rating : 4
----------------------------------------------------------------------
QAId : 6368751
Asker : sanjay_bhatia
Subject : problem with unix
Private : No
Question : I got a assignment from my university, if someone can help me out to
get the real answer for the whole assignment for free, would be really
appreciated but if someone has to spend special time then please let me know
that how much you will charge for it.
*********************************************
Please go to the link below:
http://www.infocom.cqu.edu.au/Courses/win2001/COIT13146/Assessment/Assignment_%31/
I would really appreciate your help in this matter
Answer : Perhaps you should read the assignment, particularly the section on
plagiarism, and then solve the problem on your own? Certainly the course that
preceded this test prepared you for such a test?
Rating : 1.3
Rating : 1.3
----------------------------------------------------------------------
QAId : 6372171
Asker : MudChell
Subject : Unix Account Management
Private : Yes
Question : I'm writing codes for removing users accounts. But after removing the
users accounts, I can still see the user's name in the last column of the group
file.
Pls advise how do I remove a user name from a group file? THanks!
*** I'm only testing it under my own account. I'm not the root user.
Answer : The only thing that makes a user a member of a group is his being
listed in the file /etc/group - if your user deletion isn't removing them from
there then you can remove them manually, but since the account doesn't exist
anymore it's not really much of a risk.
Rating : 2
----------------------------------------------------------------------
QAId : 6435337
Asker : MudChell
Subject : Unix statement
Private : No
Question : Pls advise the correct interpreatations of the following Unix
statement:
rm -rf ` ls /tmp | sed -e `/^\.$/d -e /^\.\.$/d'`
Answer : It is a garbled sed statement as-is, but it appears to be trying to
remove all files from the /tmp directory *except* the "." and ".." directory
entries. Here is what it should look like:
rm -rf `ls /tmp | sed -e '/^\.$/d' -e '/^\.\.$/d'`
The first part of the sed statement:
-e '/^\.$/d'
will look for lines that begin(^) with a period (\.) and are followed by nothing
up to the end of the line($). It will then delete(/d) those lines.
The second part of the sed statement:
-e '/^\.\.$/d'
performs a second edit command and does the same as the first, except it looks
for two periods and and end-of-line (EOL).
--
Paul Doherty
http://members.home.net/iqueue
DOS/Windows Utilities
Rating : 3
----------------------------------------------------------------------
QAId : 6454046
Asker : vlinda2000
Subject : NFS maestro
Private : No
Question : IN Windows Explorer of Windows 2000, when I copy a folder from
Windows 2000 to a folder on a Solaris machine using NFS Maestro, the permission
always are chmod 700 for the folder and all the files and subfolders under this
folder also has chmod 700. I would like it to chmod 755 automatically on every
files and folders. Do I set this auto chmod somewhere in NFS Maestro of Windows
2000 or on the Solaris machine?
Many thanks
Linda
Answer : I'm not that familiar with NFS Maestro, but I would bet your problem is
with a umask setting (either in Maestro, or on the UNIX machine you're copying
files to). Try to find where the default umask for copied files gets set within
Maestro or examine the umask setting on the UNIX machine (on my Solaris machine
it is set as 022 within /etc/profile).
--
Paul Doherty
http://members.home.net/iqueue
DOS/Windows Utilities
----------------------------------------------------------------------
QAId : 6554018
Asker : slimshady74
Subject : UNIX
Private : No
Question : I would really like to start learning unix but I don't know where to
start. I mean is unix free and if it is from where can I download it and some
tutorials to get me started.
Answer : The easiest way to gain experience with a PC is to get a copy of Linux.
You can get one from here:
ftp.linuxberg.com
cd into /pub/ISO and you will find ISO (CD) images of many Linux distributions.
I suggest Mandrake as it is excellent. Once you get the ISO file you can use
Easy CD Creator or another CD burning program to make a CD from it.
Then for assistance with Linux try this web site:
http://www.linuxnewbie.org
--
Paul Doherty
http://members.home.net/iqueue
DOS/Windows Utilities
----------------------------------------------------------------------
QAId : 6609898
Asker : mha_a
Subject : Permission denied
Private : No
Question : hi
I tried to delete a directory
rm -r *
but it comes this output
man1/a2p.1: override protection 555 (yes/no)? y
man1/a2p.1 not removed: Permission denied
but i am sure i am the owner for this directory.
Is there a way to force deleting such directory??
Answer : Have you tried
rm -Rf dirname
Rating : 5
----------------------------------------------------------------------
QAId : 6610380
Asker : aserebry
Subject : IP address
Private : No
Question : Hi,
I need to find out an IP address on the UNIX server. How can I do that?
Thanks!
Answer : Type:
ifconfig -a
Rating : 2
Answer : Try becoming root first... ;-)
----------------------------------------------------------------------
QAId : 6626172
Asker : sanagapalli_2000
Subject : Internet connection problem in Sun Solaris
Private : No
Question : Hi,
I have installed Sun Solaris on intel platform. Can some one help me how to
connect to net from Sun Solaris box.
Thanks
Answer : Use "ifconfig -a" to view your interfaces and configure them (man
ifconfig for syntax)
Also ensure you have the proper DNS info in:
/etc/nsswitch.conf
/etc/resolv.conf
--
Paul Doherty
http://members.home.net/iqueue
DOS/Windows Utilities
Rating : 4
----------------------------------------------------------------------
QAId : 6748158
Asker : aserebry
Subject : C Shell
Private : No
Question : Hi,
I'm writing a small app in c shell scrip (.sch extension) Do you know the
correct syntax of the while look in c shell.
Thanks!
Answer : I wrote you a small example program to demonstrate it:
#!/usr/bin/csh
# example of a csh while loop
set i=0
echo $i
while (1)
echo $i
set i=`expr $i + 1`
if ($i > 10) break
end
--
Paul Doherty
http://members.home.net/iqueue
DOS/Windows Utilities
Rating : 5
----------------------------------------------------------------------
QAId : 6748519
Asker : aserebry
Subject : Syntax in C Shell
Private : No
Question : /home/rndftp/extracts/custstmt/chk_stmt_dt.plset $chkstmtdtret=$?
This is what I'm trying to do in C Shell . First line runs a different script
and the second line assins the value returned by the script to the variable. I'm
getting an error on the second line: Variable syntax. Can you tell me what is
the problem in these two lines accourding to C Shell script syntax rules.
Thanks a lot!
Answer : The problem comes from the fact that the first script is running its
own shell command. Then you are launching another and attempting to get the
return value from it within the first. One way to do this is to run the second
script's commands *inline* with the first. I did it with these test files I
wrote; the first is called "test1.csh" and the second is called "returncode.csh"
test1.csh:
#!/usr/bin/csh
set chk=0
echo CHK is $chk
source /export/home/ped/scripts/returncode.csh
echo CHK value is: $chk
returncode.csh:
set chk=27
Notice that I am able to change the value of the variable from the first script
by the line in the second, because I use the "source" command to run the
contents of the second script within the first, which stops the second
invocation of a csh interpreter. The result of a run:
./test1.csh
CHK is 0
CHK value is: 27
--
Paul Doherty
http://members.home.net/iqueue
DOS/Windows Utilities
----------------------------------------------------------------------
QAId : 6748529
Asker : aserebry
Subject : Syntax in C Shell
Private : No
Question : /home/rndftp/extracts/custstmt/chk_stmt_dt.plset $chkstmtdtret=$?
This is what I'm trying to do in C Shell . First line runs a different script
and the second line assins the value returned by the script to the variable. I'm
getting an error on the second line: Variable syntax. Can you tell me what is
the problem in these two lines accourding to C Shell script syntax rules.
Thanks a lot!
Answer : The problem comes from the fact that the first script is running its
own shell command. Then you are launching another and attempting to get the
return value from it within the first. One way to do this is to run the second
script's commands *inline* with the first. I did it with these test files I
wrote; the first is called "test1.csh" and the second is called "returncode.csh"
test1.csh:
#!/usr/bin/csh
set chk=0
echo CHK is $chk
source /export/home/ped/scripts/returncode.csh
echo CHK value is: $chk
returncode.csh:
set chk=27
Notice that I am able to change the value of the variable from the first script
by the line in the second, because I use the "source" command to run the
contents of the second script within the first, which stops the second
invocation of a csh interpreter. The result of a run:
./test1.csh
CHK is 0
CHK value is: 27
--
Paul Doherty
http://members.home.net/iqueue
DOS/Windows Utilities
----------------------------------------------------------------------
QAId : 6758272
Asker : Anonymous
Subject : REMOVING A NETWORK INTERFACE
Private : Yes
Question : I need help with removing a network interface.
OS: Solaris
I know how to install one: ifconfig hme0 plumb
But for some reason, one of my collegues must of added 2 identical ones, because
when I do ifconfig -a, I see 2 hme0 interfaces.
I went to /etc and I saw 2 files:
hostname.hme0 and hostname6.hme0
I erased the hostname6.hme0 but it did not remove the network interface.
What command do I use to remove the 2nd hme0 network inferface?
Am I correct in assuming that the present configuration is incorrect as
pertaining to having 2 hme0 network interfaces?
Should the next interface be hme1?
Thanks!
Neapolitan
Need More Information : Can you show me the exact output from an
ifconfig -a
FUQuestion : lo0: flags=1000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4> mtu 8232
index 1
inet 127.0.0.1 netmask ff000000
hme0: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2
inet 192.168.5.2 netmask ffffff00 broadcast 192.168.5.255
lo0: flags=2000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv6> mtu 8252 index 1
inet6 ::1/128
hme0: flags=2000841<UP,RUNNING,MULTICAST,IPv6> mtu 1500 index 2
inet6 fe80::a00:20ff:feff:ddbf/10
hme1: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 3
inet 10.0.0.30 netmask ffffff00 broadcast 10.0.0.255
Answer : You don't have two hme0 interfaces, you have the hme0 interface loaded
with BOTH ipv4 and ipv6 (next-generation) protocols. The IPv6 is the new longer
internet addresses. If you're not using it you can remove it or leave it - it's
not hurting anything.
--
Paul Doherty
http://members.home.net/iqueue
DOS/Windows Utilities
Rating : 3
End :
----------------------------------------------------------------------
QAId : 6791522
Asker : Anonymous
Subject : Sharing A Folder
Private : Yes
Question : I have Samba installed so I can view my Unix machine in Windows 2000.
I see that I have a shared folder that I can mapped to. When I do ls -la, the
folder looks like this:
web -> /home/httpd/html/
What does this mean?
How can I share a folder? What command do I use? Alos, what does the
/home/httpd/html/ mean and how can I use it to my advantage?
Thanks!
Neapolitan
Answer : Samba makes UNIX machines speak the same networking language as Windows
machines.
You will need to add the paths you want to share on the UNIX machine to your
smb.conf file (should be in /etc) similar to this:
[public]
comment = Public Stuff
path = /home/public
public = yes
writable = yes
printable = no
More docs on the smb.conf file are here:
http://www.linuxdoc.org/HOWTO/SMB-HOWTO-6.html
--
Paul Doherty
http://members.home.net/iqueue
DOS/Windows Utilities
Rating : 5
End :
----------------------------------------------------------------------
QAId : 6840502
Asker : Anonymous
Subject : newbie: Installing Patches from CD Rom
Private : No
Question : Hi,
I've been given a Sunsolve CD rom (version 5.0.3)
and told to download the latest patches.
I'm new to Solaris so could someone outline the
steps needed after I physicaly mount the CD rom.
Thanks
Answer : Just run (as root)
patchadd -d .
in the directory with the patch.
If you got all the "recommended" patches in a group and extracted them all into
a directory it may look like this:
[ped@]newton] /export/home/ped/8_Recommended $ ls
108434-03 109238-02 110322-01 111071-01
108435-03 109277-02 110380-03 111090-03
108528-11 109279-18 110383-02 111098-01
108652-40 109318-20 110387-03 111111-01
108725-05 109320-04 110390-02 111177-06
108727-09 109322-08 110453-01 111232-01
108827-12 109324-02 110458-02 111234-01
108869-10 109326-06 110460-09 111293-04
108875-09 109470-02 110615-01 111310-01
108968-05 109657-05 110662-04 111325-01
108974-14 109667-04 110668-01 111327-04
108975-05 109742-04 110670-01 111504-01
108977-01 109783-01 110700-01 111548-01
108981-07 109805-04 110723-03 111570-01
108985-03 109882-04 110898-02 111596-02
108987-07 109885-05 110901-01 111606-02
108989-02 109888-12 110903-02 111659-02
108991-17 109898-05 110916-02 111826-01
108993-04 109904-05 110934-04 111874-02
108997-03 109906-06 110939-01 111881-01
109007-06 109951-01 110943-01 CLUSTER_README
109091-04 110075-01 110945-03 copyright
109147-12 110283-04 110951-01 install_cluster
109181-04 110286-03 111069-01 patch_order
Note the extra files included, one of which is a script called "install_cluster"
which will handle running patchadd for you. You can just run it as
./install_cluster
--
Paul Doherty
http://members.home.net/iqueue
DOS/Windows Utilities
Rating : 3
End :
----------------------------------------------------------------------
QAId : 6913656
Asker : demund_98
Subject : xwd command
Private : No
Question : i've got 2 unix connected together. How can i use the xwd (X Window
dump) command to dump the screen of another machine through a remote login?
I must use remote login cos the machine is running some application and the only
way to "print screen" is to remote login and perform xwd. though i know the
syntax of xwd, it does not seem to work.
can you give me an example assuming that i want to "print screen" from a unix
named "Tomato" and output to a file named "Tomato"? this is assuming that i will
rlogin from another unix.
I have no problem doing xwd on a unix, but has problem doing xwd on ANOTHER
unix.
Thanks
Answer : Since you didn't show the syntax you're using, or what UNIX this is
I'll display what the command would look like:
xwd -display tomato_ip_or_dns_name:0 -root | xwud
Or
xwd -root -display tomato:0 | xwud -display pumpkin:0
will open a window on your machine, pumpkin, containing the image currently
displayed on tomato:0. You must have access rights to both displays.
Or you can do it like this:
xwd -display:tomato filename
which should give you an image 'filename' viewable in xview.
Also look into VNC which will allow real-time remote control:
http://www.uk.research.att.com/vnc/
--
Paul Doherty
http://members.home.net/iqueue
DOS/Windows Utilities
Rating : 5
----------------------------------------------------------------------
QAId : 6996130
Asker : bottaxxgp25
Subject : Copy files from unix
Private : No
Question : Hi from italy.
I'm not very skilled in UNIX.
Can i copy with the command cp all the file with a creation date greater of a
specified date?
Thanks for all.
Gian Paolo from Milan.
Answer : To do this you will need a file that has a date of creation/access the
same as the cutoff date and time you want to use. To create a fil just issue a
command like this:
touch -t 12021630 /tmp/stuff
This will create a file "/tmp/stuff" that will show a creation/access date of
Dec 02 of the current year (several days ago). You then can use that file to
perform the search and copy for files newer than that with this:
cd /wherever/your/files/are
find . -newer /tmp/stuff -type f -exec cp {} /wherever \;
"-newer /tmp/stuff" indicates you only want files newer than the date of the
file you just created.
The "-type f" will ensure that only files are copied and not directories.
The "-exec cp {} /wherever" will copy each found item to /wherever.
--
Paul Doherty
http://home.attbi.com/~bitbucket911
DOS/Windows Utilities
Answer : Don't forget to rate the answers you receive on AskMe.com... thanks!
----------------------------------------------------------------------
QAId : 7012343
Asker : probin
Subject : Learning UNIX
Private : No
Question : I want to learn UNIX quick. I have a system running Windows 98 with
two partitions C and D. 1. What is the best way to install UNIX on these
machines.
2. Which UNIX will be suitable for learning purposes?
3. Can I download UNIX systems from Internet using Windows computer and then
copy those files to some other system for installation?
Please help.
Answer : Since most of us don't have the expensive antive UNIX systems that run
Solaris, or AIX at home, Linux is a good alternative to get familiar with a UNIX
system since it's so similar.
Get the ISO images for free at the site below. Just burn them to CDs and install
to any system you like.
http://www.linuxiso.org
--
Paul Doherty
http://home.attbi.com/~bitbucket911
DOS/Windows Utilities
Rating : 3
----------------------------------------------------------------------
QAId : 7013437
Asker : sls5012
Subject : commands for creating users & their accounts
Private : Yes
Question : Hello Paul,
I am learning Unix now. I have installed Unix2.6, but just can't get any
graphics like admintool. At the # prompt, I type: admintool, I got:
# can't open display
Could you tell me how can I get these graphics?
What's the commands for add users and their accounts without using admintool
graphic?
Thanks in advance,
Linda
sls5012@yahoo.com
Answer : To get admintool to work (I'm assuming you're in Solaris and running
CDE (the graphic interface) you'll need to set the DISPLAY environment variable
- type:
ksh
DISPLAY=X.X.X.X:0
export DISPLAY
where X.X.X.X is your IP address - get it with:
ifconfig -a
As for creating users from the commandline:
useradd -d /export/home/newuser -m -k /etc/skel -s /usr/bin/ksh newuser
then create a password:
passwd newuser
Also, please refrain from asking questions as private - this is not an
embarrasing or private question and you reduce the value of our interaction by
setting the question as private. No one else can read it.
--
Paul Doherty
http://home.attbi.com/~bitbucket911
DOS/Windows Utilities
Rating : 5
FUQuestion : Hi Paul,
I will not ask quiestion as private again.
I have successfuly added users and password. But I can not get the graphic
displaied. I got the same message: cann't open dispaly.
Thanks very much,
Linda
Answer : Try it as:
DISPLAY=X.X.X.X:0.0
export DISPLAY
or
export DISPLAY=X.X.X.X:0.0
I left off the ".0" in the first example I gave you.
--
Paul Doherty
http://home.attbi.com/~bitbucket911
DOS/Windows Utilities
----------------------------------------------------------------------
QAId : 7034260
Asker : sls5012
Subject : how to exit "ed" tool
Private : No
Question : Hi Paul,
Thanks for your previous answer.
In Unix 2.6, I used ed command to edit my files. How can I exit this edit tool?
e.g. $ ed my_file
1,$p
/ .../
" how can I exit the ed command?"
Thanks in advance,
Linda
Answer : Just type q by itself and hit enter.
Rating : 5
----------------------------------------------------------------------
QAId : 7042853
Asker : sls5012
Subject : what is the diff between HP-Unix & Unix
Private : No
Question : Hello,
What are the difference between HP-Unix and Unix?
I am searching a position now. I found one company requires experience in
HP-Unix/Oracle SQL.
So I want to know the difference of HP-Unix and Unix.
Thanks in advance,
Linda
Answer : UNIX is a general term that encompasses all UNIX systems. It describes
in the most general terms what it is to be UNIX> HP UNIX, Solaris (Sun), AIX
(IBM), and all others are variants of UNIX and will share many similarities.
They will also have many peculiarities and proprietary items where they will
differ. So when someone says they want HP-UX UNIX they mean they want someone
who knows that flavor of UNIX.
--
Paul Doherty
http://home.attbi.com/~bitbucket911
DOS/Windows Utilities
Rating : 4
----------------------------------------------------------------------
QAId : 7094864
Asker : sls5012
Subject : Variables
Private : No
Question : Hello,
I try to store a value inside a shell variable. What I did:
witch% count=1
I got:
count=1: command not found
Could you tell me how can I store a value inside a shell variable?
Thanks in advance,
Linda
Answer : Your problem stems from the fact you're using the C shell (csh). You
can do it this way in csh:
set count=1
echo $count
In sh (Bourne), ksh (Korn) or bash (Bourne Again) you can do it like this:
ksh (to get to a Korn shell)
count=1
echo $count
--
Paul Doherty
http://home.attbi.com/~bitbucket911
DOS/Windows Utilities
Rating : 5
FUQuestion : Hi Paul,
1. How can I remove these variables? If these variables are not removed, will
they take some memory?
2. How can I change to sh (Bourne), ksh (Korn) or bash (Bourne Again) shell?
Thanks in advance,
Linda
Answer : As I mentioned above just type in the name of the shell you want from
the shell you're in to invoke a new shell of that type. So if you're currently
in csh (C shell) and want a Korn (ksh) shell just type:
ksh
and you'll be in a Korn shell and can do the things you want. You can then
"logout" and you'll be back in the csh shell.
If you decide you like one shell over another you can change your default shell
with the chsh (not available in all systems) or you can edit the file:
/etc/passwd
and change the shell entry at the end of the line that has your entry with the
shell you want - for example your entry may look like this:
myacct:x:108:1::/export/home/myacct:/usr/bin/csh
You change the line to be like this to get Korn
shell as your default:
myacct:x:108:1::/export/home/myacct:/usr/bin/ksh
Be aware that sh/ksh use different files (they use .profile in your home
directory) for initializing your session so you may need to migrate any PATH or
other settings to the .profile in order to maintain those settings. If you get
good results typing ksh at a prompt (not missing PATH info or anything) it's
probably fine to switch on over to ksh in the /etc/passwd (plus you can always
switch back).
--
Paul Doherty
http://home.attbi.com/~bitbucket911
DOS/Windows Utilities
----------------------------------------------------------------------
QAId : 7128801
Asker : thd1811
Subject : tar with the p option
Private : No
Question : When I do a tar I want to preserve the date and file permissions so I
use the p option. I was wondering where I would put the p in a command like
this:
tar cfp - <dir>|(cd <dir2> ; tar xfp -)
Do I need to put the p twice??
thanks,
Answer : tar -cvpf - <dir> | (cd <dir2> ; tar -xvf -)
The "f" parameter needs to immediately precede the location and that is why
yours is failing.
FUQuestion : Is that true with Solaris systems too? It seems to work without
having the f option preceding the location, the thing I was wondering is if I
need to specify the p option twice. thanks!
Answer : I don't believe the 'p' applies to extracting the files. 'p' preserves
the permissions during archiving and is the default during extraction with 'x',
per the man page:
"p Restore the named files to their original modes, and
ACLs if applicable, ignoring the present umask(1).
This is the default behavior if invoked as super-user
with the x function letter specified. If super-user,
SETUID and sticky information are also extracted, and
files are restored with their original owners and per-
missions, rather than owned by root. When this func-
tion modifier is used with the c function, ACLs are
created in the tarfile along with other information.
Errors will occur when a tarfile with ACLs is
extracted by previous versions of tar."
--
Paul Doherty
http://home.attbi.com/~bitbucket911
DOS/Windows Utilities
Rating : 5
----------------------------------------------------------------------
QAId : 7131982
Asker : Terrtorr
Subject : General question
Private : No
Question : Which is better MCSE & RHCE or a BA in Computer Sceince.
Answer : That depends on whether you'd like to have a career in IT (BA) or be an
IT wage-slave your whole life, relegated to technical jobs (MCSE/RHCE).
I hate to sound so sarcastic but I get sick of people trying to equate 4 full
years of study and sacrifice to certifications that can be achieved in 6 months
of part-time study. They are not even close to the same thing.
--
Paul Doherty
http://home.attbi.com/~bitbucket911
DOS/Windows Utilities
Rating : 4
----------------------------------------------------------------------
QAId : 7143713
Asker : piyux
Subject : How to trigger a script after to receive a file from a remote host?
Private : No
Question : Hi guys, I'll appreciate your help with the following problem.
I'm using remote shared folders (nfs server/client) to move information from
several remote hosts (sun and linux) to a central host (linux). After to receive
a file I need to do something with it. But the problem is the size. Sometimes
the file is huge, and although I can see the filename in the local folder, it is
under a transfering process yet.
Is there any way to trigger an event and to run a script after to receive the
entire file?
Thanks for the advice...
Piyux
piyux@hotmail.com
Answer : I wrote a script like this some time ago, and I post it here for your
use/modification. It's purpose is to watch a given file's size and to exit when
the file size no longer changes. Adding this to your script (or running it
immediately before your script) can pause execution until the file transfer is
complete.
#!/usr/bin/ksh
rm /tmp/lastsize /tmp/sizediff /tmp/currsize 2>/dev/null 1>&2
touch /tmp/currsize
touch /tmp/lastsize
while :
do
cp -p /tmp/currsize /tmp/lastsize >/dev/null 2>&1
ls -l $1 | awk '{ print $5 }' > /tmp/currsize
diff /tmp/currsize /tmp/lastsize >/tmp/sizediff
if ! [ -s /tmp/sizediff ];
then
break;
fi
sleep 10
done
rm /tmp/lastsize /tmp/sizediff /tmp/currsize 2>/dev/null 1>&2
echo "\a"
echo "\a"
echo "\a"
sleep 2
echo "\a"
echo "\a"
echo "\a"
sleep 2
echo "\a"
echo "\a"
echo "\a"
echo "File is done..."
--
Paul Doherty
http://home.attbi.com/~bitbucket911
DOS/Windows Utilities
Rating : 5
----------------------------------------------------------------------
QAId : 7172441
Asker : thd1811
Subject : ftp: connectio refused
Private : No
Question : I'm running an Ultra10 with Solaris 2.8 and I when I try to connect
via ftp from another machine it gives me
connection refused message.
I've checked the /etc/ftpusrrs file,
/etc/shells, /etc/inetd.conf and /etc/services files.
I;ve also checked netstat -a|grep ftp
and it looks like it is listening.
I can do a ftp localhost from the machine and it works fine. A
The /etc/servcies file says ftp-data port 20 and ftp port 21
when I do a ftp <hostname> 21 it works, but isn't the default port 21 anyways.
Why do I have to specify the 21 port?
I'm stumped, please help ,thanks,
Answer : Did you check for the presence/contents of the files:
/etc/hosts.deny
/etc/hosts.allow
?
FUQuestion : Yeah, I just checked and the system does not have any of these
files, I have never heard of these files, are they something you would commonly
find on Solaris systems? I've heard ot /etc/ftpusers only, thanks,
Thomas
Answer : Check your file:
/etc/shells
If it doesn't exist create it, and in it list your shells and the paths to them:
/usr/bin/sh
/usr/bin/ksh
/usr/local/bin/tcsh
etc....
--
Paul Doherty
http://home.attbi.com/~bitbucket911
DOS/Windows Utilities
FUQuestion : Hi Paul, I chek'd the /etc/shells file and everything seems to be
there but I still have to specify the 21 port, any more suggestions? thanks,
Thomas
Answer : Check your /etc/nsswitch.conf and ensure that, unless you are using
NIS(+) you have "files" then "dns" listed for services.
Also check your /etc/services file and ensure you don't have any duplicate
entries for ftp:
cat /etc/services | grep ftp
--
Paul Doherty
http://home.attbi.com/~bitbucket911
DOS/Windows Utilities
FUQuestion : Hi Paul,
Yeah, everything looks good in the /etc nsswitch.conf file and the /etc/services
file, this is a real stumper for me. BTW, what is the difference between ftp and
ftp-data in the /etc/services file? and alsi if you have any more places I
should check that would be great thanks,
Thomas
Answer : FTP uses ports 20 and 21 for communication/data transfer. Without
looking it up I'm thinking that port 20 is the control port and 21 is the data
port, but I could have them backwards. Those two entries in /etc/services
correspond to those ports.
I found some relevant hits - some info below - have you tried rebooting the box
or HUPing inetd?
http://sunsolve.sun.com/pub-cgi/retrieve.pl?doc=fsrdb%2F12116&zone_32=ftp%20%22connection%20refused%22
Also check to be sure the ftp streams line isn't commented out in the
/etc/inetd.conf file.
FUQuestion : I haven't tried rebooting the system yet but maybe that will do the
trick since everything that we've looked at so far looks ok. Thanks a lot for
your help,
Thomas
Rating : 5
Answer : You're welcome...
----------------------------------------------------------------------
QAId : 7172450
Asker : Anonymous
Subject : crontab and mailing
Private : No
Question : hey eveyone,
can any one tell me whether i can run a mail command from crontab.
I have a script that does the following:
wall < delete
where delete is a file
when i try to run this script in a crontab file it dosent seem to want to work
and dosent mail all the users. my cron file is :
0 20 * * * mailusers
can any one tell me if this will work and if so, why it wont
thanks !!
Answer : A 'wall' command is a broadcast to all logged in users, not a mail
command. Which did you really need? Can you show me the script you're trying to
make work so I can see what you're trying to do?
----------------------------------------------------------------------
QAId : 7172457
Asker : bdowns
Subject : Add a permanent route to aix unix
Private : No
Question : I need to add a permanet route to a AIX Unix