removing a file in unix [closed] - unix

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
In a UNIX filesystem, if the inode of the root directory is in the memory, what are the sequence of disk operations needed to remove a file in Desktop?
While I am trying to solve a question in textbook, I have seen this question but I could not solve it . Can anyone help me ?
If you know much about Unix, can you tell me what are sequence of disk operation needed for creating a file in Desktop ?

Use rm to remove files in Unix. e.g.,
rm file_to_delete
or better yet if you are uncertain about working in Unix
rm -i file_to_delete
which will prompt with the name of the file to be deleted to confirm the operation.
The file_to_delete can be in the current directory, or in some other directory as long as the path is properly specified.
See rm man page for more information.
As for creating a file, you can create an empty file with the touch command. I.e.,
touch some_file
will create an empty file named some_file. Again, this can be in the current directory, or any directory with the path specified.
For more information see the touch man page.
Your questions wasn't quite clear to me, so if this doesn't answer it please add a comment or (better yet) consider possibly rephrasing your original question or at least the title of your question (removing a file in unix)

Related

How does UNIX handle a move of a file between two disk file systems? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 4 years ago.
Improve this question
I have three directories on a UNIX box, as described below:
/tmp mapped on /dev/mapper/data-tmpVol1
/var mapped on /dev/mapper/data-varVol1
/opt mapped on /dev/mapper/data-optVol1
If I perform a move operation from /tmp to /var, will the UNIX do in fact a copy since there are two different file systems behind scene?
If I want an instant move, is it better to copy the file first in a /var/staging and perform a move from /var/staging to /var/input?
Context around the issue: I have a process which scans for files in /var/input, and I've seen cases when it picked up half-copied files (when moving directly from /tmp to /var/input).
Regards,
Cristi
When moving across file systems, you may like to create a file in the destination directory with a temporary filename, e.g. my-file.txt~. The scanning process must ignore such temporary filenames. When the file is complete you rename it to the final name. This way when the file (with a final name) exists it is complete, or it doesn't exist at all.

why I am not getting results from my uncompressing? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 4 years ago.
Improve this question
I am using a Dragonfly BSD system and I need to uncompress a folder for configuration purpose. I could not find results, the compressed file was still there without the uncompressed folder I should find. To test if the problem was something more specific I tried the same tar -xf but later also adding v (verbose) option with an ordinary text file but what I found was the tar showing me the uncompressed file when on the verbose, meanwhile I couldn't find it (by ls command) neither open it.
You specified tar -xvf ntest.tar /jeff/ but none of the file names starts with / — you should specify tar -xvf ntest.tar jeff/ to get the files extracted.
Incidentally, 'useful' only has one ell.

Why can't I change directory [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
I'm trying to move directory to another directory.
But I can't only change include directory which includes header files for database in C programming.
First, I typed "mv include /usr/include" in terminal so that change directory.
Then Error message shows up which says "rename mysql.h to usr/include Operation not permitted".
I want it for #include .
Could you please help me to find solution?
Best regards,
Don't try to move your include files to the system include directory - it's read only.
Instead, use the command line -I argument to force the compiler to check your directories as well as the system ones e.g.
cc -I/path/to/my/sql/includes mycprogram.c
You'll probably find you also need to use the -L and -l switches at some point soon.

copying .tar.gz file while writing it [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
Is writing a .tar.gz file purely sequential?
When copying a large file, I started compressing it, and while it was compressing, scping it to a different machine. Afterwards I checked the md5sum on both machines, and they did not match. I guess it wasn't the best idea ever to start reading the .tar.gz before it was finished. I supposed that writing that .tar.gz file would only append to the end so that reading it would work out fine.
Does anybody know anything about the mechanics of this? What specifically is happening here?
If you were doing to scp with a simple .tar file, it could work.
tar is a sequential archiving tool mostly designed to be piped to cpio to write on a tape.
But here, you ask tar to first create the archive and then compress it. The compression can happen only after the archive is finished.

How to rsync files with --files-from with quantifier? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
I want to move from one server to another and I won´t lost special logfiles (like mail.logs), so want to rsync the files with the --files-from option. But I can´t use a quantifier like * or {0..9} in the file list.
rsync -avR --files-from=/backup/filelists/filelist1.txt / $DESTSRV:"$DESTPATH"
for example I want to rsync all mail server log files
/var/log/mail.log
/var/log/mail.log.1
/var/log/mail.log.2.gz
/var/log/mail.log.3.gz
/var/log/mail.log.4.gz
But in the /backup/filelists/filelist1.txt I can´t use
/var/log/mail*
or
/var/log/mail.log.{2..10}.gz
I got the following error
rsync: link_stat "/var/log/mail*" failed: No such file or directory (2)
Anybody knows a solution for my problem?
After searching and trying I found another solution that fits to me:
cat /backup/fileslists/filelist1.txt | { while read line; do rsync -avzR $line "$DESTSRV":"$DESTPATH"/; done; }
This code reads the input file line by line and sync it with rsync. In this case I could use any quantifier :).

Resources