Having a memory lapse:
If I redefine a command using an alias or a function - How do I access the "real" command without specifying an absoulte path:
i.e.
function man
{
/usr/bin/man |more
}
alias ls='/usr/bin/ls -l'
How do I specify the ls or man command above without the... (6 Replies)
how do I alias the following command:
ls -l |egrep 'drw|dr-|d--|d-w'
The alias command needs single quotes and so does the above command, so this does not work:
alias LSDIR 'ls -l |egrep 'drw|dr-|d--|d-w' '
My problem is how do I get a listing of only directories?
Solaris 8
SUN Ultra 10... (4 Replies)
Hello, I am trying to set an alias in my .kshrc or .profile and when I do it is not setting. If I do it manually it works fine. Is there another file I should put this in? Here is the alias I am using.
alias ll='ls -ltr'
I am using solaris 9. When I type alias it does not show these... (5 Replies)
I am new to unix and therefore I did a lot of reading before posting. So please, if this has been answered before, forgive me for re-posting and point me to the right place for the answer. I have spent many hours searching the net and read over 50 posts in this forum and even tried a few thing but... (20 Replies)
Hi Friends,
I have added some aliases in .bash_profile file under the root folder. Its works fine and very useful, but does not go well with cp command.
alias deploy="cd /usr/local/tomcat/webapp"
alias artifacts="cd /usr/local/artifacts"
but when i try to cp from artifacts folder... (2 Replies)
Iam facing some strange issue with alias. I have an alias file in which i have created lot of aliases as given below.
export BUILD_HOME=/apps/psr/build
export DB_HOME=/apps/psr/database
export LOGS_HOME=/apps/psr/logs
export BUILD_TEST=/apps/psr/build_dev/build_test
export... (0 Replies)
Hi,
I'm on Solaris (SunOS wsp2cm01 5.10 Generic_150400-10 sun4v sparc SUNW,Sun-Fire-T200). Trying to set up an alias like below -
alias grep="/usr/xpg4/bin/grep"but when I call grep in my command it ignores my alias & uses /usr/bin/grep instead. The problem with /usr/bin/grep is that it doesn't... (24 Replies)
Hi ,
Using bash shell (mintty) in cygwin/windows env. for some time and having issues with most basic commands.
Will be quite easy to get er done once I know how , just like magic tricks. I need either alias OR shell script to change windows to posix path AND put that line back -input OR .cd to... (2 Replies)
I have several shell scripts which contain the nawk command.
Here is what i m doing assign the correct value to nawk as nawk is not found on a new systems.
Here is what i did.
more test.sh
] && alias nawk=/usr/bin/gawk
] && alias nawk=/usr/bin/nawk
] && alias nawk=/usr/bin/awk... (7 Replies)
Hi,
I have the following aliases:
$: alias | grep "^du="
du='du -s * 2>/dev/null | awk '\''{ printf "%4.2f-KB ==> %s \n", $1/1024 , $2 }'\'' | sort -rn'
$: alias | grep "^dutop10="
dutop10='du -s * 2>/dev/null | awk '\''{ printf "%4.2f-KB ==> %s \n", $1/1024 , $2 }'\'' | sort -rn | head... (2 Replies)
Discussion started by: newbie_01
2 Replies
LEARN ABOUT LINUX
pivot_root
PIVOT_ROOT(2) Linux Programmer's Manual PIVOT_ROOT(2)NAME
pivot_root - change the root file system
SYNOPSIS
int pivot_root(const char *new_root, const char *put_old);
DESCRIPTION
pivot_root() moves the root file system of the calling process to the directory put_old and makes new_root the new root file system of the
calling process.
The typical use of pivot_root() is during system startup, when the system mounts a temporary root file system (e.g., an initrd), then
mounts the real root file system, and eventually turns the latter into the current root of all relevant processes or threads.
pivot_root() may or may not change the current root and the current working directory of any processes or threads which use the old root
directory. The caller of pivot_root() must ensure that processes with root or current working directory at the old root operate correctly
in either case. An easy way to ensure this is to change their root and current working directory to new_root before invoking pivot_root().
The paragraph above is intentionally vague because the implementation of pivot_root() may change in the future. At the time of writing,
pivot_root() changes root and current working directory of each process or thread to new_root if they point to the old root directory.
This is necessary in order to prevent kernel threads from keeping the old root directory busy with their root and current working direc-
tory, even if they never access the file system in any way. In the future, there may be a mechanism for kernel threads to explicitly
relinquish any access to the file system, such that this fairly intrusive mechanism can be removed from pivot_root().
Note that this also applies to the calling process: pivot_root() may or may not affect its current working directory. It is therefore rec-
ommended to call chdir("/") immediately after pivot_root().
The following restrictions apply to new_root and put_old:
- They must be directories.
- new_root and put_old must not be on the same file system as the current root.
- put_old must be underneath new_root, that is, adding a nonzero number of /.. to the string pointed to by put_old must yield the same
directory as new_root.
- No other file system may be mounted on put_old.
See also pivot_root(8) for additional usage examples.
If the current root is not a mount point (e.g., after chroot(2) or pivot_root(), see also below), not the old root directory, but the mount
point of that file system is mounted on put_old.
new_root does not have to be a mount point. In this case, /proc/mounts will show the mount point of the file system containing new_root as
root (/).
RETURN VALUE
On success, zero is returned. On error, -1 is returned, and errno is set appropriately.
ERRORS
pivot_root() may return (in errno) any of the errors returned by stat(2). Additionally, it may return:
EBUSY new_root or put_old are on the current root file system, or a file system is already mounted on put_old.
EINVAL put_old is not underneath new_root.
ENOTDIR
new_root or put_old is not a directory.
EPERM The calling process does not have the CAP_SYS_ADMIN capability.
VERSIONS
pivot_root() was introduced in Linux 2.3.41.
CONFORMING TO
pivot_root() is Linux-specific and hence is not portable.
NOTES
Glibc does not provide a wrapper for this system call; call it using syscall(2).
BUGS
pivot_root() should not have to change root and current working directory of all other processes in the system.
Some of the more obscure uses of pivot_root() may quickly lead to insanity.
SEE ALSO chdir(2), chroot(2), stat(2), initrd(4), pivot_root(8)COLOPHON
This page is part of release 3.27 of the Linux man-pages project. A description of the project, and information about reporting bugs, can
be found at http://www.kernel.org/doc/man-pages/.
Linux 2007-06-01 PIVOT_ROOT(2)