Tagged Questions
1
vote
0answers
41 views
File shows different size after copying to another directory
I used cp -rP <dir name> <new dir name> to copy the contents of a directory, including permissions etc from one dir to another. The odd thing is, either du is giving me some strange ...
1
vote
2answers
32 views
Is it possible to run software as a different user under OS X Mountain Lion?
I've been trying to run apps as a different user.
Attempt 1
sudo -u otheruser open /Applications/TextEdit.app launches the app but it uses the current user, not otheruser.
Attempt 2
login username ...
1
vote
3answers
94 views
How to paste multiple Bash commands into a shell without losing some?
It's nice to copy-paste a series of Bash commands that you find on a website. But depending on the commands, sometimes you lose a few. Maybe they get swallowed up by programs that read from standard ...
1
vote
3answers
79 views
Rename recursively files, while keeping the extension
I have a bunch of directories that each hold one *.txt file in it (and other non *.txt files).
I'd like to rename those files recursively from the command line, basically *.txt to info.txt.
So all ...
0
votes
1answer
15 views
launch an automatic action once connected to a specific ssid on OS X
My college requires a local gateway authentication webpage after connecting to their wifi, so I would like to make my macbook pro to automatically run curl with the proper user and password when I ...
0
votes
0answers
21 views
Certain actions in Terminal.app in OS X cause noise in audio/video streaming
If I'm listening to something in Pandora or YouTube, and I'm in Terminal.app in OS X 10.7.5, if I use the up arrow to scroll through bash command history, then that works fine with no noises. But, if ...
2
votes
1answer
29 views
How do I disable my internet using curl or wget to hit my router in a script?
I want to be able to run some kind of shell script/curl commands to toggle my TV services by accessing a form on my router page using curl or wget.
I have been able to get past authentication using ...
1
vote
1answer
25 views
Can't run 'rails' inside Tmux session in Terminal
I just tried rails inside a tmux session in iTerm2 and it returns as
-bash: /usr/bin/rails: /usr/bin/ruby: bad interpreter: No such file or directory
I can run rails outside of tmux . I am using ...
0
votes
0answers
18 views
How to quickly add multiple routes on Mac OsX
After connecting to OVPN, I need to add many routes (more than 3000).
It can be done by sudo reoute add X.X.X.X/X X.X.X.X for each one rules, but it's really slow. Is there any other alternative ...
8
votes
6answers
262 views
In Bash (Mac/Linux terminal shell), can the up and down arrow keys be made to function as they do in text editors?
In text editors, if I press the up and down arrow keys, it moves the cursor between lines of text.
In Bash, if I’m typing a long command that spans multiple lines and I press the up and down arrow ...
1
vote
1answer
40 views
How can I remove these bash errors?
I'm using Mac OS X 10.6.8. When I'm launching Terminal, I'm getting these messages.
How can I remove this error? I want get rid of this configuration from the bash profile.
-bash: ...
1
vote
1answer
46 views
How to set NIC in promiscuous mode on mac book air?
I am trying to run my nic on MacOSx at promiscuous mode and then use tshark / tcpdump
Option1:
ifconfig en0 promisc
but I get this message:
ifconfig: promisc: bad value
Option 2:
I tried sudo ...
0
votes
2answers
54 views
Script to auto execute creation of ssh tunnel
I'm a CS student, and still learning a lot of these things, and so please bear with me if I don't have a full grasp on what I'm trying here.
I'm on a Mac, connecting to a linux machine. I can set up ...
-2
votes
0answers
48 views
Error when using Chef on OS X: “bash: chef-solo: command not found” [closed]
I have chef installed on my local machine: Mac OS X 10.8.3
I also have chef installed on a remote server: Ubuntu 12.10 x64 Server
On the local machine, when I try to execute a command using ssh ...
2
votes
2answers
43 views
How do I investigate commands being run when changing directories?
I see “awk”, “find”, “sed”, and “which” momentarily appear in my Terminal window's title when changing directories. (And not all of these always appear and there could be some I'm missing; I imagine ...
2
votes
1answer
63 views
Difference between / and // directories in bash OSX
I was working in the bash terminal on my system (OSX 10.8.3 / bash version 3.2.48(1)-release (x86_64-apple-darwin12)) and I accidentally typed "cd //" instead of "cd /" to get back to the root ...
3
votes
0answers
55 views
How can I get zsh to display international characters properly?
I just started using zsh, and love it. However, I've stumbled upon an annoyance when it comes to international characters:
➜ ~ touch åäö.txt
➜ ~ ls
...
1
vote
1answer
27 views
How to change all occurrences of one character in a group of filenames with another?
I have some OS X files, some of which have hyphens in their filenames. I want to change all occurrences of hyphens to underscores.
How can I do this from the command line on OS X?
So, if I have ...
1
vote
1answer
29 views
Inconsistent results using cut on output of ls
I am struggling to understand why I get different output from the same command run on a single file in Terminal (Mac OS X 10.6.8) and run on more than one file. As I want to run the command in a bash ...
1
vote
3answers
37 views
Determine location of an alias in Unix (or Mac)
I have a Mac at work and my coworker set up an alias for me so that when I type git-tf at the command prompt it runs /opt/git-tf-2.0.1/git-tf. However I'm not sure how he did this. My $PATH variable ...
0
votes
1answer
54 views
Command line in OSX breaks when I edit bash_profile
Please help me, I am learning how to add sublime to command line from this link
and when I created .bash_profile file, in the first line I typed export PATH= and saved it.
My command line is broken. ...
0
votes
1answer
54 views
OS X - Adopt “command not found” behavior from Ubuntu
There is a question about overriding the default command not found behavior on Ubuntu. It is Here. I tried adding the following to ~/.bash_profile, /etc/bashrc and /etc/profile, but no luck:
function ...
0
votes
3answers
77 views
Grep for This and NOT That in a File?
How can I grep for files in a directory structure that have this text
addDesignControlChangeNotification
but are missing this text
removeDesignControlChangeNotification
Thanks!
Note: I mean the ...
0
votes
2answers
23 views
How to make scripts run from anywhere on OS X?
I've correctly added my scripts folder to my $PATH. But I still cannot run the scripts from anywhere by simply calling them. How do I achieve this?
Example. If I have ~/scripts/ in my path and in ...
0
votes
0answers
23 views
Ability to setup ask for password for longer than 4 hours?
Is there a way to way to set the delay for longer like 8-10 hours?
I have a wakeup sunrise app that i love, but had to remove password for it to work. But i could set the delay to 8 or 10 hours it ...
2
votes
3answers
51 views
osx: selectively zip large number of files: -@ option OK?
I need to make a zip file archiving ~100k files from a directory containing ~500k files. I get "argument list too long" errors when I try the obvious commands:
zip archive.zip *pattern*.txt ...
3
votes
0answers
17 views
How do I skip the requirement to hit tab twice on a soft link autocomplete? [duplicate]
When I am in the bash terminal (Mac) and I am selecting a file, I can easily type the first part of a directory and hit tab to have it auto complete, for example:
cat ~/Desk [tab] -> cat ...
0
votes
2answers
33 views
Default text for the shell read command?
Basically I want default input that the user can edit if necessary. Eg:
Please enter the city: Toronto
where "Toronto" is the default text and the user can actually delete it and enter another ...
-1
votes
1answer
35 views
I Can't get the Subl Command to function
I am trying to get the Sublime Text 2 command "subl" to work in Terminal but I am having trouble.
I keep getting a "command not found" after it already told me that the file existed. What am I ...
0
votes
3answers
46 views
How to mount a Windows shared drive on OS X given a Windows user like this: myserver@mydomain.com
I have a script in OS X which is something like this:
tell application "Finder"
try
mount volume "SMB://myuser:mypwd@myhost/sharedfolder"
end try
end tell
It works fine, but now ...
1
vote
2answers
104 views
I want to run an rsync command at midnight but make it stop at 8am. How can i schedule the start AND END of a command?
I want to run an rsync command at midnight but make it stop at 8am. How can i schedule the start AND END of a command?
I've looked into cronjobs but that will only start at a certain time. Any ideas ...
1
vote
1answer
163 views
git push to github via cron on mac
I'm trying to use git push in a bash script being run by crontab to push a commit to github. At the end of the script I'm doing this:
# script processes some files, then:
git add -A
git commit -a -m ...
3
votes
1answer
75 views
Diff between two directories and keep only the unchanged ones
I need to diff two directories:
A: /path1/
B: /path2/
The directory A contains all files and subdirectories that are also contained in B.
The files in A (and in its subdirectories) can have ...
0
votes
2answers
49 views
how do you loop through a list of deep stacked folders and move all the files to one specific folder in unix?
I downloaded a bunch of images files but they are ordered recursively by month and day so there is a folder and a file for the day of the month, I am trying to loop through all the files found by the ...
1
vote
2answers
82 views
Why doesn't this spawn a root shell?
I'm on OSX 10.8.
Before my experiment it's like this:
Nathan-der-Graue:~ max$ ls -l /bin/bash
-r-xr-xr-x 1 root wheel 1333920 17 Feb 15:22 /bin/bash
Then I run
Nathan-der-Graue:~ max$ sudo ...
2
votes
1answer
80 views
Redo typing in OSX bash
In bash on OSX I can do ctrl-_ to undo what I most recently typed. Is there a corresponding redo command?
3
votes
2answers
85 views
How do I back out of sudo privileges in OS X
Is there a command to de-elevate the user from sudo permissions after I execute a command such as sudo pmset sleep 0 so that when I try to execute another sudo command it asks for my password again?
...
3
votes
2answers
52 views
Vim execute process in background
I would like to run a process in the background in Vim on Mac OS X (or Unix in general).
I would hope and expect the following, or some variant, to accomplish this:
execute "!my_command &"
or
...
0
votes
1answer
57 views
Make Bash script with “chattr” work under OS X
Can anyone help me adapt this script to Mac OS X?
USR=$(logname)
f=`find /home/$USR/documents -name "*.doc" -o -name "*.xsl" -o -name "*.pdf"`
for file in $f
do
chattr +i $f
done
My goal is to ...
1
vote
2answers
40 views
Open remote git repository from command line
I'm using git on a Mac, and I'd like to know if there's a command to open the remote repository (origin) in a browser from the terminal.
1
vote
3answers
60 views
Is it possible to retrive in one file bash's history commands?
I have a lot a commands that I want to run again, but there are a lot of them, and going up to them with the up arrow key is too long. Is it possible to get it in a cat/tail command and pipe it to a ...
2
votes
2answers
88 views
Do aliases slow down a shell's start?
Sometimes my shell (zsh) takes longer to start than usual (I open the terminal, and it hangs a bit until I can input commands).
I have a few aliases on my .zshrc (well, actually they're in a ...
1
vote
1answer
174 views
How to redirect multiple bash commands to a variable AND screen?
I would like to capture a subshell's output in a variable and print it in the terminal screen simultaneously. Is it possible to do this by assigning the subshell to a variable and piping stdout and ...
0
votes
1answer
77 views
How to permanently reset my $PATH?
I was trying to add something to $PATH and it went totally wrong. I now can't run any commands such as ls. I've looked at this answer ...
14
votes
2answers
1k views
How can Homebrew print a beer mug in Terminal?
Homebrew has a neat trick of printing out little icons next to its output. Like this:
If I copy paste the icon it on its own and hit enter I get the result:
-bash: $'?\237\215?': command not found
...
2
votes
1answer
295 views
Open Sublime Text 2 with new tab instead of new window
I've got an alias to open files in Sublime Text 2:
alias sub='/Applications/Sublime\ Text\ 2.app/Contents/MacOS/Sublime\ Text\ 2'
But this spins up another instance of Sublime Text 2 (complete with ...
1
vote
1answer
57 views
rm !(myfile) does not work on OS X?
The command works fine on Linux but on OS X Mountain Lion when I'm doing:
rm !(myfile)
bash complains:
bash: !: event not found
Is there any way to do it the same on OS X?
1
vote
0answers
30 views
android base64 cli conversion utilities
I want to encode a file into android base64. Android's sdk has a utility method that does this. I should be able to avoid doing any Android programming to solve this. There are utilities for windows ...
1
vote
1answer
259 views
Solve bash script without goto
I have a bash script that I want to do something like
read one_thing
read another_thing
And then it runs some code to see if another_thing is available or already taken, and if it is taken, it ...
3
votes
1answer
41 views
Mac OS X Doesnt run .bashrc by itself
When I open a new terminal I don't get the prompt I setup in ~/.bashrc or my aliases etc... If I run exec $SHELL then everything applies like it should for example:
Last login: Mon Jan 7 09:02:00 on ...

