Sponsored Content
Full Discussion: understanding mv command
Top Forums Shell Programming and Scripting understanding mv command Post 302361984 by saravanan71184 on Wednesday 14th of October 2009 03:32:41 PM
Old 10-14-2009
understanding mv command

hi
i was moving a file from one directory to another with the following cmmand

mv /home/hsghh/dfd/parent/file.txt .

while doing so i i accidently

mv /home/hsghh/dfd/dfd .

although i gave ctrl c and terminate the move command some of the file are missing in the parent directory and they are not in current directory also

is there a way i can get those files restored
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Need help understanding script command

We use a UNIX-based system (Lawson) at work and I was given this command to request a data extract from the db admin. The only thing I really understand is the last line as it appears to be joining the files created from the first three lines into one. Is there anyone who can help me breakdown the... (4 Replies)
Discussion started by: KGee
4 Replies

2. Shell Programming and Scripting

understanding the sed command

Guys, I am trying to understand the sed command here. adx001 $ a=/clocal/dctrdata/user/dctrdat1/trdroot/recouncil adx001 $ b=`echo $a | sed 's/\//\\\\\//g'` adx001 $ echo $b \/clocal\/dctrdata\/user\/dctrdat1\/trdroot\/recouncil The sed command i took it from the script. Please... (3 Replies)
Discussion started by: mac4rfree
3 Replies

3. Shell Programming and Scripting

Help Needed in understanding this command

Hi All, I search the forum for my query, Glad that got solution to it. But i really want to understand how does this command work. sed -e ':a' -e 's/\("*\),\(*"\)/\1~\2/;ta' Basically it is replacing all the comma(,) characters in between quotes with a tilde. Specially what does ':a' ,... (2 Replies)
Discussion started by: DSDexter
2 Replies

4. Shell Programming and Scripting

understanding the kill command

Hi Guys, I like to know if i have a process which triggers 10 different child processes. How to identify out of the 11 processes running which is the parent process and what are the child process? And if i kill the parent process will the child process be killed.. if not is there a way to... (2 Replies)
Discussion started by: mac4rfree
2 Replies

5. UNIX for Dummies Questions & Answers

Understanding the output command

Could you please explain me whats happening in the below code, appreciate your help, Thank you. /product/apps/informatica/v7/pc/ExtProc/NewDAC/dacRecBuilder.sh /product/apps/informatica/v7/pc/TgtFiles/NEW_DAC/DAC_Pos_TradeInv_Records.out ... (5 Replies)
Discussion started by: Ariean
5 Replies

6. Solaris

Understanding 'du' command

Hi I have a questions related 2 commands : 'du' and 'ls'. Why is the difference between output of 'du' and 'ls' cmd's ? Command 'du' : ------------------ jakubn@server1 /home/jakubn $ du -s * 4 engine.ksh 1331 scripts 'du -s *' ---> shows block count size on disk (512 Bytes... (5 Replies)
Discussion started by: presul
5 Replies

7. Shell Programming and Scripting

Understanding 'find' command

I want to understand what does this command do:confused::confused: find . \( -type f -o -type 1 \) Plz someone explain me ! Thanks much in advance!! (2 Replies)
Discussion started by: sears
2 Replies

8. UNIX for Dummies Questions & Answers

Understanding nm command output

After running nm command on any object file from out put can we get to know that wheather a symbol is a call to a function or definition of function ? I am searching a class and function definitions inside many .so files. I have 3 files which contain the symbol but I don't know wheather they... (2 Replies)
Discussion started by: yatrik007
2 Replies

9. UNIX for Dummies Questions & Answers

understanding sed command

Hi Friends, I need a small help in understanding the below sed command. $ cat t4.txt 1 root 1 58 0 888K 368K sleep 4:06 0.00% init 1 root 1 58 0 888K 368K sleep 4:06 0.00% init last $ sed 's/*$//' t4.txt 1 root 1 58 0 888K ... (3 Replies)
Discussion started by: forroughuse
3 Replies

10. Shell Programming and Scripting

awk : Need Help in Understanding a command

Hello I am working on a Change request and Stuck at a point. The below awk command is used in the function. float_test ( ) { echo | awk 'END { exit ( !( '"$1"')); }' } I understand that awk 'END' is used to add one line at the end and exit is used to end the script with an error... (4 Replies)
Discussion started by: rahul2662
4 Replies
MKTEMP(3)						   BSD Library Functions Manual 						 MKTEMP(3)

NAME
mktemp, mkstemp, mkdtemp, mkdtempat_np, mkstemps, mkstempsat_np, mkostemp, mkostemps, mkostempsat_np -- make temporary file name (unique) LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <unistd.h> char * mktemp(char *template); int mkstemp(char *template); char * mkdtemp(char *template); char * mkdtempat_np(int dfd, char *template); int mkstemps(char *template, int suffixlen); int mkstempsat_np(int dfd, char *template, int suffixlen); int mkostemp(char *template, int oflags); int mkostemps(char *template, int suffixlen, int oflags); int mkostempsat_np(int dfd, char *template, int suffixlen, int oflags); DESCRIPTION
The mktemp() function takes the given file name template and overwrites a portion of it to create a file name. This file name is guaranteed not to exist at the time of function invocation and is suitable for use by the application. The template may be any file name with some num- ber of 'Xs' appended to it, for example /tmp/temp.XXXXXX. The trailing 'Xs' are replaced with a unique alphanumeric combination. The number of unique file names mktemp() can return depends on the number of 'Xs' provided; six 'Xs' will result in mktemp() selecting one of 56800235584 (62 ** 6) possible temporary file names. The mkstemp() function makes the same replacement to the template and creates the template file, mode 0600, returning a file descriptor opened for reading and writing. This avoids the race between testing for a file's existence and opening it for use. The mkdtemp() function makes the same replacement to the template as in mktemp() and creates the template directory, mode 0700. The mkostemp() function is like mkstemp() but allows specifying additional open(2) flags (defined in <fcntl.h>). The permitted flags are O_APPEND, O_SHLOCK, O_EXLOCK and O_CLOEXEC. The mkstemps() and mkostemps() functions act the same as mkstemp() and mkostemp() respectively, except they permit a suffix to exist in the template. The template should be of the form /tmp/tmpXXXXXXsuffix. The mkstemps() and mkostemps() functions are told the length of the suf- fix string. The mkdtempat_np(), mkstempsat_np(), and mkostempsat_np() functions act the same as mkdtemp(), mkstemps(), and mkostemps() respectively, except in the case where the path specifies a relative path. In this case, path is treated as relative to the directory associated with the file descriptor fd instead of the current working directory. RETURN VALUES
The mktemp() and mkdtemp() functions return a pointer to the template on success and NULL on failure. The mkstemp(), mkostemp(), mkstemps() and mkostemps() functions return -1 if no suitable file could be created. If either call fails an error code is placed in the global vari- able errno. ERRORS
The mkstemp(), mkostemp(), mkstemps(), mkostemps(), and mkdtemp() functions may set errno to one of the following values: [ENOTDIR] The pathname portion of the template is not an existing directory. The mkostemp() and mkostemps() functions may also set errno to the following value: [EINVAL] The oflags argument is invalid. The mkstemp(), mkostemp(), mkstemps(), mkostemps() and mkdtemp() functions may also set errno to any value specified by the stat(2) function. The mkstemp(), mkostemp(), mkstemps() and mkostemps() functions may also set errno to any value specified by the open(2) function. The mkdtemp() function may also set errno to any value specified by the mkdir(2) function. NOTES
A common problem that results in a core dump is that the programmer passes in a read-only string to mktemp(), mkstemp(), mkstemps() or mkdtemp(). This is common with programs that were developed before ISO/IEC 9899:1990 (``ISO C90'') compilers were common. For example, calling mkstemp() with an argument of "/tmp/tempfile.XXXXXX" will result in a core dump due to mkstemp() attempting to modify the string con- stant that was given. LEGACY SYNOPSIS
#include <unistd.h> The include file <unistd.h> is necessary and sufficient for all functions. SEE ALSO
chmod(2), getpid(2), mkdir(2), open(2), stat(2), compat(5) STANDARDS
The mkstemp() and mkdtemp() functions are expected to conform to IEEE Std 1003.1-2008 (``POSIX.1''). The mktemp() function is expected to conform to IEEE Std 1003.1-2001 (``POSIX.1'') and is not specified by IEEE Std 1003.1-2008 (``POSIX.1''). The mkostemp(), mkstemps() and mkostemps() functions do not conform to any standard. HISTORY
A mktemp() function appeared in Version 7 AT&T UNIX. The mkstemp() function appeared in 4.4BSD. The mkdtemp() function first appeared in OpenBSD 2.2, and later in FreeBSD 3.2. The mkstemps() function first appeared in OpenBSD 2.4, and later in FreeBSD 3.4. The mkostemp() and mkostemps() functions appeared in OS X 10.12. BUGS
This family of functions produces filenames which can be guessed, though the risk is minimized when large numbers of 'Xs' are used to increase the number of possible temporary filenames. This makes the race in mktemp(), between testing for a file's existence (in the mktemp() function call) and opening it for use (later in the user application) particularly dangerous from a security perspective. Whenever it is possible, mkstemp() or mkostemp() should be used instead, since it does not have the race condition. If mkstemp() cannot be used, the filename created by mktemp() should be created using the O_EXCL flag to open(2) and the return status of the call should be tested for fail- ure. This will ensure that the program does not continue blindly in the event that an attacker has already created the file with the inten- tion of manipulating or reading its contents. BSD
December 18, 2015 BSD
All times are GMT -4. The time now is 07:31 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy