10 More Discussions You Might Find Interesting
1. Solaris
Hello,
I am creating a new disk using the following command:
dd if=/dev/zero of=/export/home/ramdisk/0 bs=512 count=4096k
after creating the disk, i tool a ufsdump of a solaris 10 filesytem (disk size 512MB)
ufsdump -cvf /export/home/ufsdump/sol_orig /and then restored the dump files onto... (10 Replies)
Discussion started by: Zam_1234
10 Replies
2. Shell Programming and Scripting
Hi experts
cp bin root src /mnt
but not copy bin/bigfile
any help?
( I post this thread in the "redhat" forum wrongly, I don't know how to withdraw that question in that wrong forum)
Thanks (6 Replies)
Discussion started by: yanglei_fage
6 Replies
3. Shell Programming and Scripting
I am trying to sort the following files from folder Bag to Apple, Cat Food, Dog Food. I can get all of the files I want into a new folder, but not sure of the best approch to get them to their final directory
My Files
==========
apple.1234.ext
apple.1235.ext
cat food 101.ext
Cat Food... (2 Replies)
Discussion started by: mtschroeder
2 Replies
4. Programming
Hello,
I've been spending a lot of hours trying to imitate cp copying a file to a directory.
cp
I just can't seem to write to a specified directory, it only creates a copy on the current directory.
any hints/tips will help! Thanks!
here's the code i've been trying to manipulate:
... (1 Reply)
Discussion started by: l flipboi l
1 Replies
5. Shell Programming and Scripting
Hi,
I am looking for an answer for following senario:
I have a text file (base.txt) which consist list of files to be searched like:
base.txt
abc.txt
def.txt
fgh.txt
Now i am going to search all the listed files in another directory after reading them one by one, once i found the... (10 Replies)
Discussion started by: apjneeraj
10 Replies
6. UNIX for Dummies Questions & Answers
Hello all,
I've been researching this problem for days, and have gotten no luck . =/
How do you copy a file to another directory without being in the same directory as the file? So, for example, say I wanted to copy the file 'my.txt' that is in the directory ' /export/hom0/user/asdf ' to the... (9 Replies)
Discussion started by: kvnqiu
9 Replies
7. Shell Programming and Scripting
Hi Everybody,
i want a samll help to write a script.
i had source location with :/user/bin (bin contains subdirectories with like names emails etc and had several files in each subdirectory)
and target location with :/usr/scripts (having same subdirectories names and had some files)... (1 Reply)
Discussion started by: Reddy482
1 Replies
8. Solaris
I have created a file that has list of all the files I want to copy into another directory.Is there a way to do it?
Thanks In advance (4 Replies)
Discussion started by: shreethik
4 Replies
9. AIX
I want to serch for a string in all the files in the root directory. i want the search to be limited to only the files in the directory i.e the search to be done only in the files not in the sub directory.
the approaches tried are
1)grep "pattern string"
this command was serching the... (3 Replies)
Discussion started by: Subbu_Angeline
3 Replies
10. UNIX for Dummies Questions & Answers
HP UX 11i
Ok my server is about to run out of space, and i would like to know if there is something that i should be doing on a regular basis to maintain the machine like logs that i should clear or dmp file that i should delete...
Thanks in Advance (2 Replies)
Discussion started by: bbutler3295
2 Replies
chroot(8) System Manager's Manual chroot(8)
NAME
chroot - Changes the root directory of a command
SYNOPSIS
/usr/sbin/chroot directory command
DESCRIPTION
Only root can use the chroot command. The chroot command changes the root directory from / to the specified directory when the command
executes. (The command specified includes both the command name as well as any arguments.) Consequently, the root of any path (as indicated
by the first / (slash) in the pathname) changes to directory and is always relative to the current root. Even if the chroot command is in
effect, directory is relative to the current root of the running process.
Several programs may not operate properly after chroot executes. You must ensure that all vital files are present in the new root file
system and the relevant pathnames for the files map correctly in the new root file system.
For example, the ls -l command fails to give user and group names if the new root file system does not have a copy of the /etc/passwd and
/etc/group files. If the /etc/passwd and /etc/group files in the new root file system represent different user and group names, then the
output from the ls -l command will be based on those names, not the ones for the system's own name database. Utilities that depend on
description files produced by the ctab command may also fail if the required description files are not present in the new root file system.
The chroot program uses the execv() function to invoke the specified command. As a consequence, the command specified must be an exe-
cutable binary, not a shell script. Further, if the program requires indirect loading (for example, due to unresolved symbols requiring
use of a shared library), then /sbin/loader as well as any files it requires (for example, shared libraries) must be present in the new
root file system in the appropriate locations.
EXAMPLES
To run a subshell with another file system as the root, enter a command similar to the following. Note in this example, the file system is
on the /dev/disk/dsk13a device and is mounted to /mnt/dsk13a: chroot /mnt/dsk13a /sbin/sh The command shown in the previous example spec-
ifies a change from the current root file system to the one mounted on /mnt/dsk13a while /sbin/sh (which itself is relative to the new root
file system) executes. When /bin/sh executes, the original root file system is inaccessible. The file system mounted on /mnt/dsk13a must
contain the standard directories of a root file system. In particular, the shell looks for commands in /sbin, /bin, and /usr/bin (among
others) on the new root file system.
Running the /sbin/sh command creates a subshell that runs as a separate process from the original shell. Press to exit the subshell and
return to the original shell. This restores the environment of the original shell, including the meanings of the current directory (.) and
the root directory (/). To run a command in another root file system and save the output on the initial root file system, enter a command
similar to the following. Note in this example, the file system is on the /dev/disk/dsk13a device and is mounted to /mnt/dsk13a:
chroot /mnt/dsk13a /bin/cc -E /u/bob/prog.c > prep.out
The previous command runs the /bin/cc command with /mnt/dsk13a as the specified root file system. It compiles the /mnt/dsk13a/u/bob/prog.c
file, reads the #include files from the /mnt/dsk13a/usr/include directory, and puts the compiled text in the prep.out file on the initial
root file system. To create a file relative to the original root rather than the new one, use this syntax and enter:
chroot directory command > file
CAUTIONS
If special files in the new root have different major and minor device numbers than the initial root directory, it is possible to overwrite
the file system.
FILES
Specifies the command path.
RELATED INFORMATION
Commands: cc(1), cpp(1), ls(1), sh(1)
Functions: chdir(2), chroot(2) exec(2) delim off
chroot(8)