Jump to content

mandri

OTW
  • Posts

    26
  • Joined

  • Last visited

Posts posted by mandri

  1. rename -v 's/[0-9]+-//g' *

    This isn't working for me?

    I have perl base installed so I'm not sure why it isn't working.

    Does the command work for you?

    If it works for you,then I'll have to investigate what I may be missing related to perl.

     

    I followed the link and it is better than most I have found.

     

    not uncommon that i bang my head

    I have been researching how to do this one task using rename for several days now.

    This has proved most difficult.

  2. Thanks for replying.

    I did miss the fact that a space was being substituted.

    I tried putting the "'s together like this "" instead of this " ",and that gave unwanted results.

     

    I still can't figure out a few things now.

    For experimenting,I created 3 directories named

    01-test_rename_a

    02-test_rename_b

    03-test_rename_c

     

    I used this

    rename "-test_" " " *

     

    That removed what I wanted OK.

    What I can't figure out is how to remove 01,02,03.

    How do you use a wildcard here to remove these numbers?

     

    Also,if I use this,just for experimenting purposes,

    rename "_" " " *

    it only removes the first instance of _.

    How can I get it to remove all instances of _?

     

    Example.Change this,

    01 remove_all_underscores_1

    02 remove_all_underscores_2

    03 remove_all_underscores_3

     

    to this?

    remove all underscores 1

    remove all underscores 2

    remove all underscores 3

     

    Do you know of a webpage that gives a lot of examples for the rename command?

    man rename in terminal didn't tell me much at all.

  3. or
    rename "%%20" " " *

    Could you explain what the " " * after the "%%20" does?

     

     

     

    I have been playing with this some with some success.

    I am only guessing here,and would be grateful is someone corrects me if I'm wrong.

     

    I am guessing that in this part,"%%20",what is inside the first set of quotes is what is to be renamed.

     

    Then in this part " " *,what is inside the second set of quotes is what it is to be renamed to.

     

    Since there is nothing inside the quotes in the second part,it will be renamed nothing,which in turn is actually just removing the first part.

    The * is saying to do this for all the files found to contain %%20 in the directory this command was entered in.

     

    Am I right?

  4. That's telling you that you haven't got a file called test.txt.

    Yes,I now see what you mean.

     

    That is what had me confused.As far as I knew,I didhave a file named test.txt.

    I had only created a new text file,and named it test.

    Not test.txt as in your example.

    I assumed a text file would automatically be given the file extension .txt.

    I do have to stop assuming things like this.

     

    Since I've see that your example does work,I have yet tried two more deviations from the example you have given,using the file named test.txt.

    Both have also worked.

    1.zip -e test test.txt

    This gave the same result,a zip file named test.zip

    2.zip -e file test.txt

    This gave the zip file the name file.zip rather than test.zip

     

    So do I have this right now?

    1.The first parameter is what you want the zip file to be named,and the second(and additional) parameter(s) is the file(s) you want to zip.

    2.It's not necessary to specify .zip in the first parameter,as my above examples did work,because Zip will give it the .zip extension anyway.

     

    Thanks for your time and being persistant with me. :thumbs:

    I now have to get a new keyboard.

    The letter z is worn off.

  5. I did try as you suggested,but it didn't work.Sorry. :P

     

    cd Desktop
    Desktop]$ zip -e test.zip test.txt
    Enter password:
    Verify password:
    	zip warning: name not matched: test.txt
    
    zip error: Nothing to do! (test.zip)

     

    So I tried random entries until I found this one that did.

     

    cd Desktop
    Desktop]$ zip -e test test
    Enter password:
    Verify password:
     adding: test (deflated 50%)
    Desktop]$

    Once I found that this worked,adding the option -r included all the files and sub-directories in a more complex scenario.

    If you want it more secret then either pack a zip file inside a password-protected zip

    That is a fine idea,no need for mcrypt. :)

  6. OK.I got it!Kind of. :D

    I kept messing with this until I found something that worked.

    OK.I did read a lot too!!!

     

    Using this command

     

    cd Desktop

    Desktop]$ zip -e -r test.zip test test

    Enter password:

    Verify password:

    adding: test/ here it added everything found in the directory named test,all the subdirectories,text files,everything

    That created a password protected zip file named test.zip.

     

    Now when I want to extract the file,it asks for the password,That's good.

    Even with using ark,if I want to open any file within the archive,it asks for the password.That's good.

     

    Only one problem left.

    That is when using ark,the archive will still open and all the file names are readily available,and listed in a tree view,even if you can't open the individual files to see their content without the password.

     

    How can I prevent ark from even opening the archive at all without the password?

    I suppose if all the file names were changed to something else that didn't identify the contents before they were archived,it wouldn't matter if the file names were easily exposed.

    That is yet another matter,and I think I'd be getting off course taking that route.

    This isn't a top secret experiment here.

    I could just as easily encrypt it with gpg if that were the case.

     

    Any ideas anyone?

    If not,I'll keep working at this,and post what I've found,if I find anything. :wall:

     

    Thanks.

     

    EDIT

    For a single file:

     

    cd Desktop
    zip -e test.zip test.txt

    This didn't work with the test.txt.See below.

    But you did clue me in with test.zip at the beginning rather than at the end.

    Desktop]$ zip -e test.zip test.txt

    Enter password:

    Verify password:

    zip warning: name not matched: test.txt

     

    zip error: Nothing to do! (test.zip)

     

    This worked.

     

    Desktop]$ zip -e test.zip test test

    Enter password:

    Verify password:

    adding: test (deflated 5%)

  7. I am still not getting nowhere with this.

    I have tried this as well

    xxxx]$ cd /home/mandri/Desktop/test

    test]$ zip -e >/home/mandri/Desktop/test.zip

     

     

    That accepts the password,and creates a zip archive on my desktop.

    The terminal just stalls at the line adding: - and the zip archive remains at 0 bytes.

     

    I also tried this

     

    cd Desktop

    Desktop]$ zip -e test >test

    bash: test: Is a directory

    For recursive subdirectories I guess you'll need to pipe the output of find into the input of zip. But I've not tried this.

    So I then tried this

     

    Desktop]$ zip -e test >test.zip

    Enter password:

    Verify password:

    zip warning: missing end signature--probably not a zip file (did you

    zip warning: remember to use binary mode when you transferred it?)

     

    zip error: Zip file structure invalid (test.zip)

     

    I also tried this

     

    Desktop]$ zip -e test >test/*

    bash: test/*: ambiguous redirect

     

    Then this

     

    Desktop]$ zip -e test/* >test.zip

    Enter password:

    Verify password:

     

    This seemed to finish,and it created a zip archive on my desktop,and I didn't see it stall at adding: - like earlier.

    But the zip archive is still 0 bytes.There's nothing in it.

     

     

    I should add because you gave examples of .txt,I am trying to zip an entire directory(a folder containing a few other folders)one folder with wallpapers,another folder with pictures from my camera,and also including text files within the parent directory,which is /home/mandri/Desktop/test

     

     

    And oh yeah,I'm getting so caught up in this,I almost forgot to say thanks for replying.

    So THANKS. :)

     

     

    EDIT

    Desktop]$ zip -e test/* >test.zip

    Enter password:

    Verify password:

     

    This seemed to finish,and it created a zip archive on my desktop,and I didn't see it stall at adding: - like earlier.

    But the zip archive is still 0 bytes.There's nothing in it.

     

    I seen there was a file size of 118 bytes,not near enough for the wallpapers and .jpegs.

    When I try to open it,I get the error "Could not open the file, probably due to an unsupported file format".

    Using ark,I get "an error occured when trying to open the archive".

     

    I have since tried this too,no luck.

     

    cd Desktop

    Desktop]$ zip -e -r test >test2.zip

    Enter password:

    Verify password:

     

    zip error: Nothing to do! (test.zip)

    Desktop]$ zip -e -R test >test2.zip

    Enter password:

    Verify password:

     

    zip error: Nothing to do! (test.zip)

    Desktop]$

  8. I tried to search for the answer to this,zip -e nothing to do,but I keep getting errors I only used 3 letters.

    Other combinations of those keywords gave very irrelevant results.

     

    Simple question.

    How do I create and password protect a zip file?

     

    I have a directory named test on my desktop.

    Inside this directory are a few more directories of copied data just for this test.

    I opened a terminal and enter zip -e /home/mandri/Desktop/test.

    After entering and confirming a password,I get the error "nothing to do!".

     

    I tried opening a terminal in the directory I want to zip,I get this error.

    "Invalid command arguments (cannot write zip file to terminal)".

    What am I doing wrong here?

     

    Also,is there a way in linux to create a password protected .rar file?

    I can create the .rar easy enough,but how can a password be added?

     

    I also know about GPG allowing the password,but I don't want to encrypt it,just simply add a password.

     

    Thanks.

  9. How do you edit your own post?

    I didn't want users and nousers,but instead user and nouser.

     

    Another thing I,ve noticed.

    Protection is only as secure as to who has access to your computer,and not so much your files on that computer.

    Anybody with a live cd can read every file there is on your computer.Even on your windows partition.

    And even those hidden windows OS files.

    You can encrypt the files to further enhance your protection against someone reading them in this case.

  10. I tried to use the command /sbin/shutdown -c within a keyboard shortcut.

    First created it as a user,than also as root.

    Once shutdown,or reboot,is selected from the log out menu,the keyboard input is not accepted.

    Maybe the wrong command?If this command is issued in console,no pid of shutdown is found.So it is a valid command.

    I have a feeling that,being that I only have a few seconds,3 of them,to issue the command to cancel the shutdown,anything short of a script will not work.

    Thanks to all.

  11. scoonma,thanks for the reply.

    Even one that says I'm off my rocker and it can't be done,is better than no reply at all.

    What you have stated does sound like what I need.

     

    First,I have two feet into something here I really do not know much about.

    I wouldn't be able to write a script myself.I don't think.

     

    I have a seperate install I use for experimenting with things like this unknown to me.So if I screw it up real bad,only takes 15 minutes to re-install,and I'll try it again.Only way I have to learn.

     

    First thing I tried,and it failed,was to edit inittab to this:

    # Trap CTRL-ALT-DELETE

    #ca::ctrlaltdel:/sbin/shutdown -t3 -r now (I commented this out)

    # Trap experiment CTRL-ALT-DELETE (And changed this to -c)

    ca::ctrlaltdel:/sbin/shutdown -c

     

     

    I had the idea,instead of figuring out how the (special) keys are addressed,to first see if -c would work with a set of keys that already was.10 steps backwards for me.

    Even with inittab modified as above,(yes,was saved as root)the keys cntr-alt delete still performed exactly as before.That was unexpected.

    I anticipated it not working at all,if nothing else.

     

    When right clicking to shutdown,the keys have no effect once(for what I believe is the reason)X has recieved the termsignal.

    The cntr-alt-delete sequence is calling up a GUI,same as right clicking,log out.

    I have to change that.

    Seems to be as well,for the immediate execution of the ctrl-alt-delete,it has to be done in console.Not a GUI based login.

     

    Well,if I ever get this figured out,I'll probally never use it anyway.

    But at least I learned something.

  12. I don't think this post belongs here,but it doesn't appear to fit anywhere else,so here it is.Maybe a mod can move it to the right place.

     

    I am trying to get/create a keyboard shortcut to cancel the shutdown,once it is selected using the right click,log out,turn off computer method.

     

    Example: A way to still issue the command "shutdown -c" ,when you suddenly realize you don't want to turn off the computer,after selecting the right click,turn off computer.

    I believe with the mac OS,you simply launch a app before the shutdown,and the shutdown is cancelled.

    Is there a simple solution with linux?

    Maybe a additional entry in etc/inittab?

    One completely independent of the mouse or GUI.Reason I'm looking for a keyboard shortcut.

     

    [moved from Talk-Talk by tyme]

  13. While we're talking about double-clicking on a file to install software, I see questions like this all the time but I guess I just don't see the point. Why try to emulate Windoze?

    I understand your concern about using the rpm -iv command rather than urpmi.And I agree.

    I also understand your questioning of why make linux look like windows aka:double clicking to install a app.

    I dislike windows with a passion,and the last thing I want to do is make linux look like windows.

     

    I was first intrigued when discovering that in Mandriva I can double click a rpm file to install a rpm.

    I haven't seen this before,or haven't noticed,not sure which, in any other distro.

    More so than really wanting to double click a rpm to install,I am trying to understand what makes double clicking work.Is it a script?Is it part of the programming language?

    As I mentioned beforehand,I noticed that the same exact rpm file in Pclos,does not install when double clicking on it.But in Mandriva,it does.Why?

     

    I'd like to change the subject to something that is not as controversial as double clicking a rpm file to install.

    But the end results should lead to the same basic understanding of double clicking.

    I have a partition on hdb1.It is not mounted automatically at boot,(it is not even listed in fstab),but still,I have created a folder in /mnt,and named it hdb1.

    I created a link to application,the command as: kdesu mount /dev/hdb1 /mnt/hdb1

    Now,"double clicking" the link I created will prompt me for the root password(same as double clicking the rpm file),then mounts the partition hdb1.

    Sure,I can list /dev/hdb1 in fstab,and save a lot of trouble,but that's not the point.I am only saying that double clicking does not necessarily have to simulate windows,and can find purpose in linux as well.

    That is a simple link,that needs to be double clicked.

     

    I am trying to understand how to get a linux operating system to recognize a rpm file as a link to application(Mandriva already does),that needs to be "double clicked",which would prompt me for the root password,then issue the command, rpm -iv.

     

    Somehow,and this is where I am very lost,Mandriva not only recognizes the rpm file as a link to application,but also discovers where the rpm file is located.It doesn't matter if the rpm file is in my /home folder,or if the rpm file is sitting on my desktop.Double clicking on the file will install it,once the root password is entered.

    and you must be in the directory where the rpm to be installed is located

    So,not only do I have to understand how the rpm file is recognized as a link to application,I need to understand how does Mandriva "discover" where the file is located.

    Sorry about the lengthy post,but I felt it is necessary to explain my reasoning behind "How to double click a rpm file to install?".

    It is not so much that I need the ability to double click a rpm file to install,as it is understanding the concept of how to create that ability.Thanks to all who took the time to read this entire post.

    mod:Being that this thread has been marked solved,should I continue posting here, being that it is the same subject,or start a new thread if needed?

  14. You are logged in as root. VERY bad, one should never run as root.

    Rest assured I never run as root.I did mention entering the root password.

    I agree that the ease of double clicking can possibly be too easy,but the root password is still needed.Someone who really didn't know the CL would have no problem with double clicking and entering a password,so I do see your reasoning.

    If the system didn't know anything about rpm packages, then it wouldn't have installed it or done anything with it

    So now,in the case of Mandriva,the "system knows what to do with the .rpm file".

    But,if using another distro,pclos for example,and the system didn't know what to do with the .rpm,how would you associate double clicking a .rpm file with the command as root rpm -iv ?

    I tried creating a link to application,run in terminal ,the command being rpm -iv,but that only opens a terminal,with no rpm to be installed,and has nothing to do with double clicking.

    Eventually I'll figure this out,but advice certainly is welcome.

  15. After downloading the rpm for adobe as neddie as posted,I double clicked on the file,and it asked to install,save ,or cancel.I installed,and had no problem with that.

    My question is,what installed it?I did not need to go to a command line,su to root,and install it as I expected I would.I did have to enter the root password,but this double clicking on the file to install has got my curiousity going.

    For example,in pclos,double clicking the same exact file does not install it.It will ask what you want to open it with instead.

    What if there were dependencies that were needed,but not present?Would it of installed anyway?

    I can only assume at this point,that neddie knew the link being provided would work without causing any problems.But I may get a false sense of this being to easy.I may download a rpm and just double click and install,without knowing myself that there are missing dependencies.

    As AussieJohn has recommended,and I do agree,I will stay within easy-urpmi for the most part to be safe,but I really would like to know why this double clicking worked.

  16. Thanks once again all.I have downloaded adobe reader and opera seperately.

    I now have them installed and all is working good there.

    I didn't add the plf non-free when setting up easy-urpmi.My mistake.I saw a lot of mirrors that were on the other end of the earth for me,and I passed that option up.I will go back in and add them later.

    I have had some errors updating with easy-urpmi,bad checksums,etc.,but that is a totally different topic.

    For now,I am happy with what I got.It's time to start exploring and using Mandriva a little first,then I'll iron out all my confusions later.

  17. I am new to Mandriva,and this forum,and of course this is my first post.

    I have been reading the wiki,searching the forums etc., about installing new packages in Mandriva.

    There certainly is plenty of already covered information to be found,but that is just about the reason I am posting this now.There is too much information.

    I have read about urpmi and urpme,the GUI(rpmdrake?)for the same,and this really isn't the problem.

    What I would like to know is this.

    Is there a one and only safe and recommended place to get the rpm's from?

    If there is,a link to,or some instruction now, would be appreciated.

    Or should one just download a rpm from anywhere a rpm can be found?

    Several different methods of installing software/apps can be found,and in good detail I might add,but I would like to hear the bottom line on what is the most recommended/safest way of doing so. Thanks.

×
×
  • Create New...