Tar no such file or directory linux

tar command can’t find file or directory [closed]

This describes a problem that can’t be reproduced that seemingly went away on its own or was only relevant to a very specific period of time. It’s off-topic as it’s unlikely to help future readers.

I’m new user of Ubuntu 12.04, and I don’t know what should I do. I had download tor-browser and in instruction it said I should use this command for extracting tar file:

tar -xvJf tor-browser-linux64-3.5.3_en-US.tar .xz 
tar (child): tor-browser-linux64-3.5.3_en-US.tar: Cannot open: No such file or directory tar (child): Error is not recoverable: exiting now tar: Child returned status 2 tar: Error is not recoverable: exiting now 
ls Downloads tor-browser-linux64-3.5.3_en-US.tar.xz 

@user264363 You did wrong because you put a space in the file’s name: .tar .xz . If there is really a space, then you should escape it: .tar\ .xz or put the file name between quotes.

1 Answer 1

You need to go to the folder where the file is to extract it. The Downloads folder is in your home folder. Your home folder is in /home/yourusername , but you can access to it with ~ . Try:

if your file is really there, then execute the tar command

tar -xvJf tor-browser-linux64-3.5.3_en-US.tar.xz 

Or if you don’t feel confident with the console, you can open a file manager, go to the location of your file, right click on it and select «extract here». This will do the same thing as your command.

If you want to avoid typos when using the terminal, you can:

  • Type tar -xvJf, and drag the file onto the terminal window. (Thanks Jacob2)
  • Start typing the name of the file name and press the Tab key. This will complete the name of the file if only one file starts with the string that you have typed. If there are more files starting with that name, press Tab again and you will see a list of options.

Источник

Bash, tar «cannot stat no such file or directory» [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.
  • This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Читайте также:  Linux extract exe icon

I’m trying to build a little backup script but I keep getting the following error:

tar: Removing leading `/' from member names tar: /projects: Cannot stat: No such file or directory tar: Exiting with failure status due to previous errors 

The folder /projects exists, but still no tar ball is created. Here is my code:

#!/bin/bash backup_files="/projects" #destination of backup dest="/" #Create archive filename day=$(date +%Y-%m-%d) hostname=$(hostname -s) archive_file="$hostname-$day.tar.gz" #Backup the files using tar tar -czf $archive_file $backup_files #Print end status message echo echo "Backup finished" 

ls -ld /projects shows the following:

ls: cannot access /projects: No such file or directory 

Any idea on what is wrong?

1 Answer 1

Filepaths that start with a leading / on Linux and other related systems are located at the root directory. This means that «/projects» usually refers to a different directory than «projects» .

It looks like you probably are trying to access a subdirectory /path/to/projects from directory /path/to using the path /projects . This is incorrect — if your working directory is /path/to , you need to access folder projects by changing backup_files=»/projects» to backup_files=»./projects» — «.» refers to the current working directory — or simply backup_files=»projects» .

So, while relative filepaths «./projects» and «projects» are usually equivalent, they are generally and functionally different from the fully qualified path «/projects» .

Источник

tar :cannot stat : No such file or directory when shell script run

I am hoping that more experts here will find some obvious syntax error or will be able to help me work around the errors. Basic idea of the script: I have a shell script which will read the list.txt and look for the files or folders I need, then copy to another directory. Working Environment: Ubuntu 12.04 Problem/Error: Before I modify, I have a demo script which copy all the files that works fine. However, when I modify the script, it gives me this error : tar : XXXXX.ko cannot stat : No such file or directory tar : Exiting with failure status due to previous errors The only thing I change is the path of the list. Shell script code shown as below

#!/bin/sh cd /home/leo/Desktop/Script_testing INSTALL_PATH=./output/.install/ NAND2_PATH=./output/nand1-2_2 if [ ! -d $NAND2_PATH ]; then mkdir $NAND2_PATH fi if [ ! -f /home/leo/Desktop/Script_testing/list2.txt ]; then echo "error : list_2 not found : " exit fi cd $INSTALL_PATH tar cf - `cat /home/leo/Desktop/Script_testing/list2.txt` | ( cd ../../../$ ; tar xf - ) 
./app_drvier/led/led.ko ./Desktop/testing/beeper.h ./Desktop/testing/beeper.c ./bin/usb_plug.sh ./etc/hostname 

when I run ./mycp.sh the directory «nand1-2_2: will be created under output, however, the error I have mentioned shown tar : XXXXX cannot stat : No such file or directory tar : Exiting with failure status due to previous errors Hope someone can help me out. Thank you so much Update After I run sh -x mycp.sh , result as below

+ cd /home/dragon/Desktop/Script_testing + INSTALL_PATH=./output/.install/ + NAND2_PATH=./output/nand1-2_2 + [ ! -d ./output/nand1-2_2 ] + [ ! -f /home/dragon/Desktop/Script_testing/list2.txt ] + cd ./output/.install/ nand1-2_2.sh: 12: cd: can't cd to ./output/.install/ + cd ../../.././output/nand1-2_2 nand1-2_2.sh: 13: cd: can't cd to ../../.././output/nand1-2_2 + tar xf - + cat /home/dragon/Desktop/Script_testing/list2.txt + tar cf - ./app_drvier/ontech_led/onetech.led.ko tar: ./app_drvier/ontech_led/onetech.led.ko: Cannot stat: No such file or directory tar: Exiting with failure status due to previous errors 

Источник

Читайте также:  Linux сколько занято озу

tar: cannot open: no such file or directory

I am trying to follow the instructions here to install Jetty on ubuntu but I am running into a problem when I try to use tar.

cd /usr/local/src sudo wget http://eclipse.org/downloads/download.php?file=/jetty/stable-9/dist/jetty-distribution-9.1.0.v20131115.tar.gz&r=1 
sudo tar -xfz etty-distribution-9.1.0.v20131115.tar.gz 
tar: z: Cannot open: No such file or directory tar: Error is not recoverable: exiting now 

What am I doing wrong? (I also tried as root but it did not help) EDIT None of the suggested answers is working for me. Below I copy my attempts from the command line. What am I doing wrong?

a@b:/usr/local/src$ ls download.php?file=%2Fjetty%2F9.1.0.v20131115%2Fdist%2Fjetty-distribution-9.1.0.v20131115.tar.gz download.php?file=%2Fjetty%2Fstable-9%2Fdist%2Fjetty-distribution-9.1.0.v20131115.tar.gz a@b:/usr/local/src$ tar -tfz jetty-distribution-9.1.0.v20131115.tar.gz tar: z: Cannot open: No such file or directory tar: Error is not recoverable: exiting now a@b:/usr/local/src$ tar -tfz /usr/local/src/jetty-distribution-9.1.0.v20131115.tar.gz tar: z: Cannot open: No such file or directory tar: Error is not recoverable: exiting now a@b:/usr/local/src$ sudo tar xfz download.php?file=%2Fjetty%2F9.1.0.v20131115%2Fdist%2Fjetty-distribution-9.1.0.v20131115.tar.gz gzip: stdin: not in gzip format tar: Child returned status 1 tar: Error is not recoverable: exiting now a@b:/usr/local/src$ sudo tar xfz jetty-distribution-9.1.0.v20131115.tar.gztar (child): jetty-distribution-9.1.0.v20131115.tar.gz: Cannot open: No such file or directory tar (child): Error is not recoverable: exiting now tar: Child returned status 2 tar: Error is not recoverable: exiting now a@b:/usr/local/src$ ^C a@b:/usr/local/src$ 

Источник

tar exits on «Cannot stat: No such file of directory», why?

Remove — from vcfz options. tar does not need hyphen for options.

With a hyphen, the argument for the -f option is z . So the command is in effect trying to archive dvr_rdk_v1.tar.gz and dvr_rdk into an archive called z . Without the hyphen, the semantics of the options changes, so that the next argument on the command line, i.e. your archive’s filename, becomes the argument to the f flag.

Читайте также:  Linux максимальный размер папки

Also check your write permission to the directory from which you are executing the command.

@MichaelMrozek Actually, removing the — does make a difference, because GNU tar is quirky. Option arguments can’t be bundled in the first argument when it doesn’t start with a — , so the argument to f is the next argument to tar , and so tar vcfz dvr_rdk_v1.tar.gz is equivalent to tar -v -c -f dvr_rdk_v1.tar.gz -z .

I also realized if I remove the z or j the archive compression is successful even with — involved. When I add the hyphen is included it treats the last character in the option as a «file». So as a result I get j or z as an archived file if I use this option -cvfz or -cvfj .

Summary: if ‘f’ occurs as an option anywhere other as than the last option, then the command will not do what was intended. I don’t see how Gnu couldn’t add a warning when they detect such a serious and easily-detectable issue. I just spent 40min trying to debug this weirdness. This one must have wasted hundreds of thousands of man-hours of productivity.

I had to remove the hyphen to make it work, although I have used the hyphen many times on other systems. Can’t they just keep the syntax consistent.

The -f option should directly precede the filename. So, use tar -vczf filename.tar.gz instead of -vcfz

Ah this explains why the command I’m using tries to create a compressed archive file called j or z with these commands -cvfj and -cvfz respectively.

The tar command historically has been one of the few commands that doesn’t follow the Unix utility syntax guidelines.

The standards page for tar says:

f
Use the first file operand (or the second, if b has already been specified) as the name of the archive instead of the system-dependent default

While the syntax guidelines include this:

Guideline 5:
One or more options without option-arguments, followed by at most one option that takes an option-argument, should be accepted when grouped behind one ‘-‘ delimiter.

So while the command you typed, tar -vcfz dvr_rdk_v1.tar.gz dvr_rdk/ , would be fine on older versions of tar, certain versions of tar that are written to strictly follow the utility syntax guidelines will parse this to mean «use z as the file argument to -f «. So you should use the following to be portable:

tar -cvzf dvr_rdk_v1.tar.gz dvr_rdk/ 

Источник

Оцените статью
Adblock
detector