cp EFI/boot/loader.efi to EFI/boot/bootx64.efi
I understand that this is the copy command, but what exactly happens to files individually when this command is run on them. Do we get duplicate files or do we get only one file? I am trying to recreate the action on Windows, as I do not have sudo access on the linux I am working on.
I got this command from a question on this forum. Please do not ask any more questions as to clarify this question. Thanks for all your answers!
This copies looder.efi to bootx64.efi. If the bootx64.efi file does not already exist, the cp command creates it. If it does exist, the cp command replaces its contents with the contents of the looder.efi file.
Related
Lots of questions like this one but none of them have helped and i've already killed a day on this single command.
Basically I need to understand how I can mv a folder into a subfolder in the same directory from a bash script.
To isolate this problem as much as possible i made the following movetest.sh:
sudo mv /home/zoctavous/vault/repos/work/recup_dir1000/ /trash/
All the folders specified exist and there are no folders that are currently named this. All I get in response is
mv: cannot stat '/home/zoctavous/vault/repos/work/recup_dir1000/': No such file or directory
please help :(
I figured out my issue... I was deleting part of the filename farther up in the script that it was a part of.
/home/zoctavous/vault/repos/work/recup_dir.1000/ is the actual directory name.
the variable for the directory was being stored as shown above
/home/zoctavous/vault/repos/work/recup_dir1000/
move directories through the cd command in Ubuntu, sometimes I don't know the location of a difinte directory.
When that happens, I find out the location of the directory through which and then use the cd command to move it.
Isn't there a way to combine these two commands into one?
Thanks to the answers, my problem has been solved. Thank you.
Yes using subshell. For instance:
cd $(which something)
We have a linux server and for some transactions it is keeping the log files only for the last 10 days. After than the file gets deleted. I want to copy these files to another location using a script. I searched google but couldn't satisfactory result. I'm new to Linux also.
Can someone please guide me if this can be achieved and how ?
You can use the previous answer by nissim abehcera in a sh script:
cp -R SOURCE_DIRECTORY DESTINATION_DIRECTORY
Just paste the bash commands in a text file, name it file.sh and make sure it is executable:
chmod +x file.sh
You can just run the script and it will do whatever you wrote in there.
I seem to be having an issue.
I'm trying to write a batch file that uses Linux commands such as rm, mv, clear, and cat within a Windows batch file, but the catch is I can't seem to figure out what I need to do in order for the Windows command line to recognize that when I type in mv I want it to move a file for me, or rm to remove a file of course.
So far all I have figured out is that I could possibly use __DOSKEY__ but it doesn't work in batch files or with parameters (doh!). Thus, all I have gotten so far is:
#echo off
mv dummy.txt
Now my question is how do I get the Windows command line to recognize that mv = move ? Everytime I run the file it just gives me a blank command line.
I know this may sound stupid but my experience is more on the Linux side of the command line than the Windows side, and any help would be greatly appreciated!
Internal cmd commands cannot be aliased. For external commands, you could create hardlinks, but "move" for example is an internal command.
I used command zip in linux (RedHat), this is my command:
zip -r /home/username/folder/compress/zip.zip /home/username/folder/compressed/*
Then, i open file zip.zip, i see architecture as path folder compress.
I want to in folder zip only consist list file *.txt
Because i used this command in script crontab hence i can't use command cd to path folder before run command zip
Please help me
I skimmed the zip man page and this is what I have found. There is not an option archive files relative to a different directory. The closest I have found is zip -j which removes the entire path and stores the files directly in the zip rather than sub directories. I do not know what happens in the case of file name conflicts such as if /home/username/folder/compressed/a.txt and /home/username/folder/compressed/subdir/a.txt both exist. If this is not a problem for you, you can use this option, but I am concerned because you did specify the -r option indicating that you expect zip to traverse sub folders.
I also thought of the possibility that your script could somehow call zip with a different working directory, but I took a look at this unix stack exchange page and it looks like their options use cd.
I have to admit I do not understand why you cannot use cd and I am very curious about it. You said something about using crontab, but I have never heard of anything wrong with changing directories in a crontab script.
I used option -j in command zip
zip -jr /home/username/folder/compress/zip.zip /home/username/folder/compressed/*
and i was yet settled this problem, thanks