Terminal commands with automator

So I am not really used to scripts and the script language nor in automator, I only made a few apps with automator like resize picture and show/hide hidden files.
Now I am about to make an app which cleans my OS, I would like to run all these commands with one click, rather then copy pasting them into terminal one- by-one.
sudo rm -rf /private/var/log/*
sudo rm -rf /private/var/folders/
cd /private/var/tmp/; rm -rf TM*
cd ~/Library/Caches/; rm -rf ~/Library/Caches/*
this would clean my mac caches and logs, like i would run it every week as im a power user.
Please someone tell me how to put all these into automator and try to be detailed. Thanks for the support!

Thanks for both positive, useful and sarcastic responses. The main reason is why I want to do this is becasuse I use different browsers, and all the cache they make is 2-3GB/day, as I use the web the most.
I see the reason why NOT TO clear it and I do understand it, but after a week it is 10-15GB for me.
And no, there isnt anyone else using my Mac, and the logs which I would nuke at every start and only keep the last and updated logs. I only need the startup and boot log.
@barney-15E yes it would be fun though
So then, I wont do anythings, as it cannot be done the way I wanted. I'll keep using Onyx.

Similar Messages

  • Terminal commands with automator and Safari

    Hey guys, I'm trying to create an automator that will open safari, enable private browsing, go to my site, and log myself in. The problem is I need a terminal command line that will ensure private browsing is enabled. Any tips / help is appreciated. Thanks

    Terminal and Unix queries are best posted to the Unix forum under OS X Technologies.

  • Terminal Command with Automator

    ok i want to use the automator to run a script so that i can view my hidden files without going through the terminal
    defaults write com.apple.finder AppleShowAllFiles FALSE
    KILLALL Finder
    these are the command but i cant get automator to run them please help

    Hi,
    What do you mean when you say you can't get Automator to run them? I created a workflow with a Run Shell Script action, put the 2 lines in the body of the action, and it seemed to work just fine.

  • Creating/running Terminal command with Automator

    I am using Parallels Desktop on my iMac. Occasionally after I shutdown Parallels Desktop/Windows the ram it used is not released back, for example, depending on what I'm running in Parallels Desktop I can use upto around 16GB or ram. Ocassionally when I shutdown Windows and in doing that Parallels Desktop too, this ram level does not go back down. I find that going into Terminal and entering the purge command puts the ram level down to what it was before I loaded up Parallels Desktop.
    I was wondering if its possible to use Automator to create a shortcut that I could then either place on my Desktop or Dock and when needed I could just double click on it and it would then load Terminal and then the purge command?
    Or is there another way that I could automate the purge command?

    I managed to work it out for myself.
    I done the following:
    In Automator I chose Application/Run Shell Script. In the box that appeared in the right side I entered purge. I then saved it to my desired location and I then dragged it onto the Dock for easy access.

  • Trying to automate a Terminal command with a password

    Hi,
    I'm a long time Mac user, but not a Terminal expert.
    I've come upon a simple hack that enables me to run two instances of Skype simultaneously. This enables me to use it with two different user names.
    The idea is to create another user on the computer and run the other Skype like this:
    sudo -u user "/Applications/Skype.app/Contents/MacOS/Skype"
    In order to simplify this for daily use, I'd like to create a small applet which runs this terminal command.
    Trying to do so with Automator's +Run Shell Script+ fails with an execution error, probably due to the fact that this sudo command requires an admin password.
    Is there any way to accomplish this?
    Thanks

    hmm... I'm afraid that didn't do the trick. It now opens the Terminal window and launches Skype with the message "another copy of Skype is already running".
    Maybe I should add another step to workflow instead?
    Thanks again, I really appreciate your help.
    Guy

  • Terminal command to rename files in bulk with wild cards?

    I had a group of files that had double extensions in the name and I wanted to strip the second extension:
    myfile.r01.1
    myfile.r02.1
    so that the new names were
    myfile.r01
    myfile.r02
    In DOS this would be accomplished easily by using the command line:
    rename myfile.r??.1 myfile.r??
    In OS X Terminal/Bash shell, though I couldn't find a command that has similar function that allows the use of wild cards in the file names.
    I tried both the 'mv' abd 'cp' commands along the lines of:
    mv myfile.r??.1 myfile.r??
    but nothing worked, even using the * for the wildcard.
    I did manage to use the Automator to accomplish the task by using some of its Finder options, but really, a simple command line would have been simpler and easier than building an Automator workflow for this.
    Can anyone point me to a unix command that would have done what I am looking for, and the proper syntax for it?
    Thanks.

    From this page: http://www.faqs.org/faqs/unix-faq/faq/part2/section-6.html
    How do I rename "*.foo" to "*.bar", or change file names to lowercase?
    Why doesn't "mv *.foo *.bar" work? Think about how the shell
    expands wildcards. "*.foo" and "*.bar" are expanded before the
    mv command ever sees the arguments. Depending on your shell,
    this can fail in a couple of ways. CSH prints "No match."
    because it can't match "*.bar". SH executes "mv a.foo b.foo
    c.foo *.bar", which will only succeed if you happen to have a
    single directory named "*.bar", which is very unlikely and almost
    certainly not what you had in mind.
    Depending on your shell, you can do it with a loop to "mv" each
    file individually. If your system has "basename", you can use:
    C Shell:
    foreach f ( *.foo )
    set base=`basename $f .foo`
    mv $f $base.bar
    end
    Bourne Shell:
    for f in *.foo; do
    base=`basename $f .foo`
    mv $f $base.bar
    done
    Some shells have their own variable substitution features, so
    instead of using "basename", you can use simpler loops like:
    C Shell:
    foreach f ( *.foo )
    mv $f $f:r.bar
    end
    Korn Shell:
    for f in *.foo; do
    mv $f ${f%foo}bar
    done
    If you don't have "basename" or want to do something like
    renaming foo.* to bar.*, you can use something like "sed" to
    strip apart the original file name in other ways, but the general
    looping idea is the same. You can also convert file names into
    "mv" commands with 'sed', and hand the commands off to "sh" for
    execution. Try
    ls -d *.foo | sed -e 's/.*/mv & &/' -e 's/foo$/bar/' | sh
    A program by Vladimir Lanin called "mmv" that does this job
    nicely was posted to comp.sources.unix (Volume 21, issues 87 and
    88) in April 1990. It lets you use
    mmv '*.foo' '=1.bar'
    Shell loops like the above can also be used to translate file
    names from upper to lower case or vice versa. You could use
    something like this to rename uppercase files to lowercase:
    C Shell:
    foreach f ( * )
    mv $f `echo $f | tr '[A-Z]' '[a-z]'`
    end
    Bourne Shell:
    for f in *; do
    mv $f `echo $f | tr '[A-Z]' '[a-z]'`
    done
    Korn Shell:
    typeset -l l
    for f in *; do
    l="$f"
    mv $f $l
    done
    If you wanted to be really thorough and handle files with `funny'
    names (embedded blanks or whatever) you'd need to use
    Bourne Shell:
    for f in *; do
    g=`expr "xxx$f" : 'xxx(.*)' | tr '[A-Z]' '[a-z]'`
    mv "$f" "$g"
    done
    The `expr' command will always print the filename, even if it
    equals `-n' or if it contains a System V escape sequence like `c'.
    Some versions of "tr" require the [ and ], some don't. It
    happens to be harmless to include them in this particular
    example; versions of tr that don't want the [] will conveniently
    think they are supposed to translate '[' to '[' and ']' to ']'.
    If you have the "perl" language installed, you may find this
    rename script by Larry Wall very useful. It can be used to
    accomplish a wide variety of filename changes.
    #!/usr/bin/perl
    # rename script examples from lwall:
    # rename 's/.orig$//' *.orig
    # rename 'y/A-Z/a-z/ unless /^Make/' *
    # rename '$_ .= ".bad"' *.f
    # rename 'print "$_: "; s/foo/bar/ if <stdin> =~ /^y/i' *
    $op = shift;
    for (@ARGV) {
    $was = $_;
    eval $op;
    die $@ if $@;
    rename($was,$_) unless $was eq $_;

  • Terminal command equivalent to Automator's 'set metadata pdf'

    Hi,
    When I make pdf docs I sometimes want to erase my name from the Author metadata, and put something into Title and so on.
    I know that Automator has an action called set pdf metadata, which I have successfully used.  But I would like a Terminal command that I could use instead.
    Googling this question returns suggestions of downloading pdf-manipulation libraries which are too elaborate for me to use.  I'm hoping that Automator is simply utilising a terminal command already built-in.
    Is there such a command?
    Diddles

    A bit of experimenting.
    Given a file temp.pdf in the current working directory . . .
    xattr -w "com.apple.metadata:kMDItemAuthors" "diddles1234" temp.pdf
    writes the string "diddles1234" to the Authors metadata field of temp.pdf.
    xattr -w "com.apple.metadata:kMDItemTitle" "newmetatitle" temp.pdf
    writes the string "newmetatitle" to Title metadata field of temp.pdf.
    However, if you try to put spaces into the string like this:
    xattr -w "com.apple.metadata:kMDItemTitle" "new meta title" temp.pdf
    the title field will not be changed to "new meta title". In fact, if you start with "original title" as the value of kMDItemTitle, successfully change it to "newmetatitle", and then later try to change it again to "new meta title", the value of kMDItemTitle reverts to "original title". The OS appears to "forget" the intermediate change to "newmetatitle".
    As best I can figure, in the event of a failed xattr write command, the original kMDItemTitle is rebuilt from semi-redundant data within the PDF--but more experimentation would be required to prove it. (The same is true of kMDItemAuthors, by the way.) Quick take away: The first two commands above will work if you don't use spaces in the strings to be inserted into the metadata fields. Someone more proficient in UNIX may have a better solution or explanation.

  • Passing files in automator to a terminal command?

    I would like to know if something is possible: I've used automator to sort through a large number of files for specific traits using the 'Filter Finder Items' action. Can I then pass these files, one by one, into a terminal command?
    Specifically, I have a bunch of markdown files that I want to run through the markdown command in the terminal.
    Thanks for any help,

    automator has "run shell script" action. just add that action to the end of your wrokflow with the option to pass input as arguments.

  • Can't seem to sync my phone with iCal because I get a message that says:No writable calendar. I tried the suggestions I found in Help including a Terminal command to no avail.

    Can't seem to sync my phone with iCal because I get a message that says:No writable calendar. I tried the suggestions I found in Help including a Terminal command to no avail.

    I can only suggest you now need to somehow link your mobile to sync with the new calendar 'On my Mac'.
    I have a work Blackberry whose calendar I sync with an iCal calendar 'On my Mac' using a usb lead and the Blackberry Desktop Manager for Mac. This free piece of software from Blackberry, automatically starts up as soon as I connect the usb to the iMac and it then prompts me to select which calendar 'On the iMac', which is writable, that I want my Blackberry to sync to.

  • Hey,i forgot my login password,so i changed the password by using terminal command(reset password).now i have new user name with new password,but i can't find  my data which i have saved on mac.please help me out in this matter.

    hey,i forgot my login password,so i changed the password by using terminal command(reset password).now i have new user name with new password,
    but i can't find  my data which i have saved on mac.the storage is showing data used and free space on the disk
    please help me out in this matter.

    How did you change your user name?
    resetpassword wouldn't have done it. If you managed to create a new user, then your data is still in the old account.

  • #30 | can i run the Terminal Command to stop Snapshots with no problems?

    i am somewhat surprised to find out that the 75 GB of "Backups" that are taking up space on my MBP may be due to some "feature" in Mavericks or the new OS's or whatever and i have had to MOVE all my data off my laptop as a consequence of this over the last two months because i have no more space on my Hard Drive.
    is it legit and OK to follow the terminal commands in #30 without having any problems?
    i am on a mid 2009 MBP running Mavericks and i have a 2 TB Time Capsule that i am wirelessly backing up my data.
    as some kind of sadistic test in advance of running this terminal command - can i plug my laptop into the Time Capsule, unplug the laptop from the time capsule, restart and see how much space got recaptured on my HD for my data?
    i mean, well - i must be missing something but i mean i am hoping i can get this to stop so i can get my data back on my laptop. i'm walking around with an external HD of all my Mac Pro information just so i can get work done when i go to a coffee shop or something.

    for those suffering through this:
    https://discussions.apple.com/message/24878591#24878591
    In Terminal:
         sudo tmutil disablelocal
    Turn off local Time Machine snapshots and trigger automatic cleanup of accumulated local snapshot data. Requires root privileges.
    (use sudo tmutil enablelocal to turn back on)
    this got rid of my 75 GB backup file (!!) and now i am going to move my data back to my laptop...
    not sure if there is an apple tech article to link to regarding this issue but it would be good to post if there is one.

  • Add "Serch Domain" in Network Preferences with Terminal command

    Hi!
    I'd like to add a Search Domain in the Network setting using a Terminal command. With this I can use ARD3 to end the command to several machines at once wihtout having to go to each machine and do it in the GUI.
    I know you can write to preference files with the Terminal, but I don't know what to type.
    Please help.
    Thanks in advance!

    Hey Camelot,
       You're getting a lot of mileage out of that new command. Kudos for finding it.
    Hi Martin,
       Naturally Camelot's command is the most elegant solution. The Systems Preferences settings for the network are stored in the /Library/Preferences/SystemConfiguration/preferences.plist property list file but I think that's only consulted at boot. The search path is too deep to be comfortably manipulated by the "defaults" command but we could probably do it with sed if that would help.
       When the network comes up, the above information is combined with data from DHCP to create the /var/run/resolv.conf file, which is linked to by the classic /etc/resolv.conf file. That has a "search" field that holds the search domains in a whitespace delimited list. I don't know how often that's consulted but that's the final source of the information.
    Gary
    ~~~~
       Life would be so much easier if we could just look at the
       source code.
          -- Dave Olson

  • Done Something Dumb, Please Help With Terminal Command

    OK, So I couldn't figure out why I was no longer getting Growl notifications with mail.app and GrowlMail after I upgraded to 10.5. Turns out it has something to do with the bundle version it is running. I ran the following 2 terminal commands found here : http://www.davidroessli.com/logs/2007/01/gettinggrowlmail_towork/
    they were:
    defaults write com.apple.mail EnableBundles 1
    defaults write com.apple.mail BundleCompatibilityVersion 2
    Once I launched mail.app again the application told me that it had shut off support for the Plaxo plugin that I use. Now neither Growl nor the Plaxo plugin work. Long story short, can someone explain to me how to put mail.app back the way it was before I foolishly ran terminal commands? Thanks in advance

    Email the author. Growl isn't supported by Apple.
    You are aware that the article was written quite a while before 10.5.2 was released? It's not a good idea to implement modifications that are not tested on the current version of OS X without checking first with the author of such modifications. It's especially not a good idea to use the "defaults write" command without knowing how to undo the change.
    The first command is undone by substituting 0 for 1. Change the second one from 2 to 3.

  • Slipstreaming: Is there a Terminal Command or an App to Slipstream 10.5 with 10.5.8 Combo Update so It Become One .DMG for Burning Purposes?

    Hi. Is there a Terminal command or an App for OS X (Snow Leopard which I'm using now as a backup OS X from an external USB drive) that can slipstream the 10.5.8 combo update to 10.5 retail installer (I 10.5.8 for an experiment) to be burned to either DVD and other media like with this Windows 8 app:
    http://lifehacker.com/how-to-slipstream-windows-updates-into-your-installatio-15 62956432
    Thank you in advance. Have a great week.
    God bless, Matt. 16:18, 1 Timothy 3:15

    Ya, I'd love to have the computers connected to the Xserver, unfortunately against my heeding, I was ordered to take them off of the Xserver, so they only have a local account that automatically logs in on startup, and even though I have Parental Controls set, I can not stop them from going to Safari, selecting an inappropriate image and setting it as the background, so now I’ve been ordered to fix all of the backgrounds that people are messing with.
    My Xserver is running OS X 10.4.11 Server Edition. Yes, I would love a new server, but that’s not happening due to budget cuts.
    So what I am hoping for is a command that I can put into Apple Remote Desktop v3.5.3 and push out to all of the computers via its Unix commands and reset all the desktops to their default image.

  • Terminal Command rsync

    I use rsync to backup my macbook pro. It gets really irritating to open the terminal to type the entire command every time I want to backup. Does anyone know how to save the terminal command as an auto-executing file, so that when I double-click the file it backs up.

    there are a lot of very good backup applications out there. why would you do it by hand with rsync?
    if you insist, you can put a GUI wrapper on it using apple script or automator.
    using automator:
    make a workflow consisting of a single action "run shell script". save the flow as an application.

Maybe you are looking for