SOLVED...mv and cd commands...

Kernels & Hardware, configuring network, installing services

SOLVED...mv and cd commands...

Postby ramblin » 2018-06-01 15:15

I thought I better ask this in a new thread before I mess everything up. I was trying to move a folder named " DWA-160_REVB_DRIVERS_1.610_LINUX" to my src folder. Instead I moved my src folder inside the "DWA-160_REVB_DRIVERS_1.610_LINUX" folder. I tried several times to move it back but thankfully I got errors. Can I move it back or can I create a new src folder inside the usr folder. I`m having a hard time wrapping my head around the cd and mv commands. Everything I study about them is over my head. This is my original command that messed it up. Thanks

Code: Select all
mv -t /home/heatlocke/Downloads/DWA-160_REVB_DRIVERS_1.610_LINUX /usr/src/
Last edited by ramblin on 2018-06-03 12:22, edited 1 time in total.
ramblin
 
Posts: 44
Joined: 2017-07-26 01:45

Re: mv and cd commands...

Postby Ardouos » 2018-06-01 17:15

ramblin wrote:I thought I better ask this in a new thread before I mess everything up. I was trying to move a folder named " DWA-160_REVB_DRIVERS_1.610_LINUX" to my src folder. Instead I moved my src folder inside the "DWA-160_REVB_DRIVERS_1.610_LINUX" folder. I tried several times to move it back but thankfully I got errors. Can I move it back or can I create a new src folder inside the usr folder. I`m having a hard time wrapping my head around the cd and mv commands. Everything I study about them is over my head. This is my original command that messed it up. Thanks

Code: Select all
mv -t /home/heatlocke/Downloads/DWA-160_REVB_DRIVERS_1.610_LINUX /usr/src/


In the man page:
Code: Select all
-t, --target-directory=DIRECTORY
              move all SOURCE arguments into DIRECTORY


AKA you:

moved /usr/src/

into /home/heatlocke/Downloads/DWA-160_REVB_DRIVERS_1.610_LINUX

as /home/heatlocke/Downloads/DWA-160_REVB_DRIVERS_1.610_LINUX is the target directory.
User avatar
Ardouos
 
Posts: 1010
Joined: 2013-11-03 00:30
Location: Elicoor II

Re: mv and cd commands...

Postby Wheelerof4te » 2018-06-01 18:07

If unsure, it's best to use your file manager for moving directories.
User avatar
Wheelerof4te
 
Posts: 1134
Joined: 2015-08-30 20:14

Re: mv and cd commands...

Postby ramblin » 2018-06-01 19:10

ardouos, I read the man before I tried this and thought /home/heatlocke/downloads/ was my target I was trying to send to usr/src.
I still have no idea how to proceed to put it back. How do I move with file manager ? I tried that first but options in the menus were not highlighted.

UPDATE: While following this logic to put things back I managed to delete the src folder completley. Nothing in there I needed any way. Now I just need to create a new src folder in usr.
ramblin
 
Posts: 44
Joined: 2017-07-26 01:45

Re: mv and cd commands...

Postby arzgi » 2018-06-02 05:23

ramblin wrote:ardouos, I read the man before I tried this and thought /home/heatlocke/downloads/ was my target I was trying to send to usr/src.
I still have no idea how to proceed to put it back. How do I move with file manager ? I tried that first but options in the menus were not highlighted.


/usr/src is owned be root, so file manager does allow acces to them as normal user.
arzgi
 
Posts: 387
Joined: 2008-02-21 17:03
Location: Finland

Re: mv and cd commands...

Postby bw123 » 2018-06-02 08:44

ramblin wrote:...
I`m having a hard time wrapping my head around the cd and mv commands. Everything I study about them is over my head.


Mayb try the first few modules at

https://linuxzoo.net/

It's pretty interesting.
User avatar
bw123
 
Posts: 3408
Joined: 2011-05-09 06:02
Location: TN_USA

Re: mv and cd commands...

Postby debiman » 2018-06-02 11:47

Code: Select all
cd /home/heatlocke/Downloads/DWA-160_REVB_DRIVERS_1.610_LINUX
sudo mv src /usr/
for obvious reasons i could not test this, so no guarantees.
might want to make a backup first.

i agree with previous posters, if cp and mv are "over your head" you should use a handholding distro like ubuntu and leave well enough alone - at least until you have learned a little more.
User avatar
debiman
 
Posts: 2927
Joined: 2013-03-12 07:18

SOLVED re : mv and cd commands...

Postby ramblin » 2018-06-03 00:57

ramblin wrote:UPDATE: While following this logic to put things back I managed to delete the src folder completley. Nothing in there I needed any way. Now I just need to create a new src folder in usr.


Thanks debiman and the rest of you trying to help. For obvious reasons this won`t help me now since there is nothing left to move. But I have studied hard and managed to solve my problem myself. Didn`t copy the commands but as root I "cd" to /usr/. Then run mkdir src and it worked ( well not right off, or even the 2nd or 3rd time but I figured it out).

debiman wrote:i agree with previous posters, if cp and mv are "over your head" you should use a handholding distro like ubuntu and leave well enough alone - at least until you have learned a little more.


I appreciate everyone looking out for me but I`m not one to sit and ask questions and expect everyone to solve my problems. My opinion is this is a test build and a learning process for me. If I mess it up so bad it won`t boot, (did it already loading wrong headers] I will learn from fixing it (did it, recovery mode, removed it all ] and I will know more in the end. Not always a good plan for everyone. Thanks guys !
ramblin
 
Posts: 44
Joined: 2017-07-26 01:45

Re: SOLVED re : mv and cd commands...

Postby debiman » 2018-06-03 07:01

ramblin wrote:I`m not one to sit and ask questions and expect everyone to solve my problems.

i wonder why you started this thread then.
a simple
Code: Select all
man mv
should've given you 90% of the answers you need (preferably before executing a command with superuser privileges), and a few simple web searches would've done the rest.

My opinion is this is a test build and a learning process for me. If I mess it up so bad it won`t boot, (did it already loading wrong headers] I will learn from fixing it (did it, recovery mode, removed it all ] and I will know more in the end.

ok.
we love to get pestered by clueless noobs which we then can slap around a bit.
but you should have mentioned the "not-mission-critical, i'm just messing around" bit right at the beginning.
but wait, maybe you'd have gotten fewer answers then?
because everybody thought that they're actually helping you with a real problem?
User avatar
debiman
 
Posts: 2927
Joined: 2013-03-12 07:18

Re: mv and cd commands...

Postby RU55EL » 2018-06-03 07:17

ramblin wrote:I thought I better ask this in a new thread before I mess everything up. I was trying to move a folder named " DWA-160_REVB_DRIVERS_1.610_LINUX" to my src folder. Instead I moved my src folder inside the "DWA-160_REVB_DRIVERS_1.610_LINUX" folder. [...]

Code: Select all
mv -t /home/heatlocke/Downloads/DWA-160_REVB_DRIVERS_1.610_LINUX /usr/src/


Looking at the man file:

Code: Select all
MV(1)                                           User Commands                                           MV(1)

NAME
       mv - move (rename) files

SYNOPSIS
       mv [OPTION]... [-T] SOURCE DEST
       mv [OPTION]... SOURCE... DIRECTORY
       mv [OPTION]... -t DIRECTORY SOURCE...

DESCRIPTION
       Rename SOURCE to DEST, or move SOURCE(s) to DIRECTORY.


If you had not used the -t switch it probably would have worked as you expected. The difference between the mv command with and without the -t switch is that the source and directory are transposed.
User avatar
RU55EL
 
Posts: 380
Joined: 2014-04-07 03:42
Location: /home/russel

Re: SOLVED re : mv and cd commands...

Postby ramblin » 2018-06-03 12:22

debiman wrote:ok.
we love to get pestered by clueless noobs which we then can slap around a bit.
but you should have mentioned the "not-mission-critical, i'm just messing around" bit right at the beginning.
but wait, maybe you'd have gotten fewer answers then?
because everybody thought that they're actually helping you with a real problem?



Wow, that pretty rough. It was never my intent to pester anyone. At the time I asked the question I really I had studied the man pages. I had googled my problem for hours. Has it occured to you that 95% of the info on the subject petains to other distros and is often incorrect. I don`t get it. If we ask questions we are clueless noobs pestering everyone. If I try and solve it myself " i'm just messing around". That OK, I`m a big boy and I can take being slapped around a bit and I will learn from it. I doubt I`ll be around though, I expect to be banned for speaking out.
ramblin
 
Posts: 44
Joined: 2017-07-26 01:45

Re: SOLVED...mv and cd commands...

Postby bw123 » 2018-06-03 12:29

There are several good "cheat sheets" for basic linux commands. linux+tutorials would also be a good search.

https://duckduckgo.com/html/?q=linux+cheat+sheet

I sort of think the difference between the two styles of providing options can be confusing. There is a single dash -t that uses no equal sign
-t /target

or the way I usually prefer, but it takes more typing.

--target-directory=/target

I wish I could just pick one style and stick with it, but some commands do not have a full set of both styles for all options.
Last edited by bw123 on 2018-06-03 12:54, edited 1 time in total.
User avatar
bw123
 
Posts: 3408
Joined: 2011-05-09 06:02
Location: TN_USA

Re: SOLVED...mv and cd commands...

Postby sunrat » 2018-06-03 12:48

Everyone makes mistakes. I once accidentally changed ownership of my whole main system to my user while booted into another OS. That was unfixable.
That said almost every question is already answered somewhere on the internet or in man pages or docs, although they can be hard to understand at times. Finding the answer there is much more educational than posting in a forum and will avoid the wrath of the hardline members.
“ computer users can be divided into 2 categories:
Those who have lost data
...and those who have not lost data YET ”
Remember to BACKUP!
User avatar
sunrat
 
Posts: 2451
Joined: 2006-08-29 09:12
Location: Melbourne, Australia

Re: SOLVED...mv and cd commands...

Postby ramblin » 2018-06-03 22:03

[quote="bw123"]There are several good "cheat sheets" for basic linux commands. linux+tutorials would also be a good search./quote]



Yes, cheat sheets are a must for me. Matter of fact I have 6 pages myself of notes in my own words between my 2 recent threads. Thanks for the help guys, I couldn`t have done it without you !
ramblin
 
Posts: 44
Joined: 2017-07-26 01:45

Re: SOLVED re : mv and cd commands...

Postby debiman » 2018-06-04 04:50

ramblin wrote:
debiman wrote:ok.
we love to get pestered by clueless noobs which we then can slap around a bit.
but you should have mentioned the "not-mission-critical, i'm just messing around" bit right at the beginning.
but wait, maybe you'd have gotten fewer answers then?
because everybody thought that they're actually helping you with a real problem?

Wow, that pretty rough. It was never my intent to pester anyone. At the time I asked the question I really I had studied the man pages. I had googled my problem for hours. Has it occured to you that 95% of the info on the subject petains to other distros and is often incorrect. I don`t get it. If we ask questions we are clueless noobs pestering everyone. If I try and solve it myself " i'm just messing around". That OK, I`m a big boy and I can take being slapped around a bit and I will learn from it. I doubt I`ll be around though, I expect to be banned for speaking out.

so, you twist my words and victimize yourself.
not that i haven't seen that one coming.

try to see it from our way: i think, oh, this newb's lost some files because didn't know how to use mv/cp, let's help them! i do invest a little time and effort in this - mind you, real time and effort, not virtual - only to be told: nevermind, this is not mission critical anyway (often also something like: "i already reinstalled" or "i deleted the vm").

it doesn't feel good: helping someone who then says they didn't need it anyway.

remember, it was you who told us off for trying to help you, bringing in the "test build" (a.k.a. "messing around") argument:
I appreciate everyone looking out for me but I'm not one to sit and ask questions and expect everyone to solve my problems. My opinion is this is a test build and a learning process for me. If I mess it up so bad it won't boot, (did it already loading wrong headers] I will learn from fixing it (did it, recovery mode, removed it all ] and I will know more in the end. Not always a good plan for everyone. Thanks guys !

well, at least you said thank you.
and it seems you have indeed learned something - hopefully not only on the technical level.

and now i feel a little conciliatory, so i'll add: you are by far not the only one doing this, maybe you got the brunt of my frustration from a dozen previous posters.
User avatar
debiman
 
Posts: 2927
Joined: 2013-03-12 07:18

Next

Return to System configuration

Who is online

Users browsing this forum: No registered users and 6 guests

fashionable