Hello wonderful people.
I'm having a problem when following this tutorial to make a program that once worked on a mac work again after the upgrade.
http://bit.ly/1RkmdBA
However i'm not allowed to move anything over to lib folder. Im getting a circle with a line in it. Even while i'm holding the option key,and yes i'm the administrator.
The next step the writer suggested is to use sudo command. Im not so savy with code. Can someone tell me the exact command line.
If you would prefer to move from one location to another:
sudo mv ~/initial/file/location ~/destination/location
if you you would rather copy instead:
sudo cp ~/initial/file/location ~/destination/location
You simply add the sudo command to the beginning of another command, and it runs the command as root (it will prompt for your password first). For example, of you want to run this as root:
mv this-file /usr/lib/
Then you would change it to:
sudo mv this-file /usr/lib/
Related
Description of Problem:
I'm trying to use terminator in a bash script but I keep getting an error stating that No such file or directory: ~/.config/terminator/config. and its keeping the terminals from popping up on screen. However when I run terminator on my terminal the window pops up. So I definitely have terminator installed I just don't know where terminator/config is.
Questions and summary of issue:
How would I check if terminator/config exists on my system?
Where would I find it since it isn't in ~/.config?
Why would this be happening?
Solutions that I know don't work and extra information
Uninstalling and reinstalling. I did it before I came to this site to ask.
These are the commands I used to install it the first time:
sudo add-apt-repository ppa:gnome-terminator
sudo apt-get update
sudo apt-get install terminator
I don't think I was at the home directory when I installed terminator if that matters.
How would I check if terminator/config exists on my system?
Either find the file using 'locate':
$ sudo apt install locate -y
$ sudo updatedb # this is to update the file database
$ locate config
Or even better, use stat:
$ stat ~/.config/terminator/config
Where would I find it since it isn't in ~/.config?
If the file does not exist, you cannot find it ofcourse.
Perhaps create the file yourself.
$ mkdir -p ~/.config/terminator/
$ touch ~/.config/terminator/config
Why would this be happening?
The systems provides an error message. Because it expects there to be file, which isn't.
Please read the documentation.
the config file is created automatically if you make same permanent changes.
start terminator
right click -> preferences
go to tab profiles -> sub tab colors
choose a different color profile e.g. "Solirized light" https://i.stack.imgur.com/QYFyp.png
close preferences and confirm the color of the terminator has
changed.
now the file "~/.config/terminator/config" has been created, containing the current user configuration.
I have currently put together a script to move files from one directory to another.
This has gone ok however I was wondering if there was a way via a shell script to get it to run from anywhere on the server e.g I give the script for someone to use on their server and they can put the script anywhere and it will run.
I know a workaround is to put the script in /usr/local/bin or usr/bin and you can run it from anywhere but that is not what I want.
Is there a way that my script will auto run from usr/local/bin regardless of if it is in /scripts for instance?
Please see my script below:
#!/bin/sh -x
mkdir -p /var/Alitest
echo "This is a test that I have created. This is to
see if the output is successful I normally do this manually but a script is required" > /var/Alitest/action.txt
sed -i 's/This is a test that I have created/The test has been successful/g' /var/Alitest/action.txt
chmod 744 /var/Alitest/action.txt
chown root:root Alitest/action.txt
mv /var/Alitest/action.txt /script/action.txt
Any help would be greatly appreciated :)
Also in my log output for the script the following error is shown:
sed: 1: "/var/Alitest/action.txt": invalid command code A
Any ideas?
You can make a soft link in /usr/local/bin for your script. Then it will be in everyone's path to be executed.
e.g. ln -s /script/yourscript.sh /usr/local/bin/yourscript.sh
After reviewing the matter further I have decided the the best way to action this is to add the folder destination e.g /scripts to my path.
This can be done by vimming into the .bashrc file on the server and adding the below line:
export PATH=/dir_name:$PATH
remember to refresh the profile in order for the changes to take effect.
You can check if this has been successful by running the below command:
echo $PATH
There is no way to get your script to do this however this would be better then a softlink as if you add it to $PATH then you do not have to go through the task of adding softlinks each time.
Thank you all for your help.
Kind Regards
Ali
I have been working on a couple of projects now. Always as I am firing up my terminal, in mac, I start at the root folder, which is fine for most of the times. But I was wondering if there is a possibility to make a file which redirects you instantly to a map. Say for instance I have to type:
cd Desktop/justamap/justanothermap/andamap/etc.
Would it be possible to create a command file in the rootfolder, containing the full adress of the designated map, which would take me to the selected map just by for instance running it?
This could save me a lot of time when working on projects with time between them.
I am truly sorry if I am reposting a question but I just couldnt find something with my keywords.
Thx in advance, your help is appreciated!
Greetings,
Kipt Scriddy
You can create a simple sh file (for instance ./anything_here) and run it:
#!/bin/sh
cd Desktop/justamap/justanothermap/andamap/etc
$ chmod +x ./anything_here
$ ./anything_here
You can also create a symlink to the folder, and then cd into the symlink (this will act like the folder is, in fact, ./anything_here):
$ ln -s ./anything_here Desktop/justamap/justanothermap/andamap/etc
$ cd ./anything_here
Or you can create an alias, and write it on the console, putting this on your ~/.bashrc or ~/.bash_profile file:
alias anything_here="cd Desktop/justamap/justanothermap/andamap/etc"
$ anything_here
Try using
vi ~/.bash_profile
it will open in vim u can use mate or anyhing else
alias project='cd Desktop/justamap/justanothermap/andamap/etc.'
close your terminal and restart it. Bingo should work for you.
Working Great for me :)
I'm currently going through http://ruby.railstutorial.org/ and it uses the command "mate" to access Textmate through the terminal. I have had Textmate on my Macbook Air (Lion OS) since I first bought it, but when I try to use a command like "mate .gitignore" the terminal gives me "mate: command not found".
I've looked through all other StackOverflow questions regarding this topic and have done the following:
Attempted to create a symbolic link through the terminal with this code.
$ sudo ln -s /Applications/TextMate.app/Contents/SharedSupport/Support/bin/mate /usr/bin
This code lets me enter my password and tells me the file exists, but still does not allow me to use the "mate" command.
Accessed Textmate/Help/Terminal Usage and tried to create a link for /usr/bin only for it to say operation not permitted.
Used alias mate='open -a textmate'. This works; however, I have to do it every time I open Terminal.
So, my question is can anyone tell me what is wrong? Love to figure this out!
Thank you!
First, you should not add anything to /usr/bin. You should add it into /usr/local/bin. Further, getting the message "file already exists" from ln means that it did not create the link. Try this:
ln -s /Applications/TextMate.app/Contents/SharedSupport/Support/bin/mate /usr/local/bin/mate
Depending on your current setup, this may have to be run with sudo. In general, if you don't know whether to run something with sudo or not, try without first and see if you get a permissions error, then use sudo.
The best way to do it is from TextMate -> preferences -> Terminal and then check install
all the previous methods didn't work for me.
After searching online, the best solution I've found so far is to just make a symbolic link in either "/Library/logs/" or "~/Library/logs/" to get it to show up in the Console application.
I'm wondering if it would be possible to add a new directory or log file to the "root" level directly under the "LOG FILES" section in the console.
Here's a quick screenshot:
There is one way to get your log files into the console.
You can add a symlink to the log file or log directory to one of the directories in the list. The directory ~/Library/Logs seems like the logical choice for adding your own log files.
For myself I wanted easy access to apache2 logs. I installed apache2 using macports and the default log file is located at /opt/local/apache2/logs.
Thus all I did was create the symlink to that directory.
# cd ~/Library/Logs
# ln -s /opt/local/apache2/logs/ apache2
Now I can easily use the console.app to get to the logs.
My solution for macOS Sierra:
First and last step, you must create a hard link from your source (log) directory into (as example) one of existing official log directories, you can seen in console.app.
I take my ~/Library/Logs directory for that.
hln /usr/local/var/log /Users/dierk/Library/Logs/_usr_local_var_log
Cross-posting this great tool for creating hardlinks originally posted by Sam.
Short intro:
To install Hardlink, ensure you've installed homebrew, then run:
brew install hardlink-osx
Once installed, create a hard link with:
hln [source] [destination]
I actually just came across this option that worked perfectly for me:
Actually if you open terminal and...
$ cd /Library/Logs
then sym-link to your new log directory. eg i want my chroot'ed apache logs as 'www'
$ ln -s /chroot/apache/private/var/log www
then re-open Console.app
drill down into /Library/Logs and you will find your sym-linked directory.
;-)
Mohclips.
http://forums.macosxhints.com/showthread.php?t=35680
In Terminal run this command... append any log file directories you want to add
defaults write com.apple.Console LogFolderPaths -array '~/Library/Logs/' '/Library/Logs/' '/var/log/' '/opt/local/var/log/'
Since Mavericks, symlink behavior as change so "ln - s" doesn't work anymore.
use hardlink-osx instead to create an hardlink to your directory (may be installed via homebrew)
Very old post I know but, this is the only way I could get it to work.
cd /Library/Logs
sudo mkdir log_files
sudo ln -s /Users/USERNAME/Sites/website/logs/* log_files
In mac os 10.11, you may not be able to link to folder of logs, but instead you need to link to each log of logs folder in side console.
ln -s /opt/local/apache2/logs/error_log ~/Library/Logs/Apache2/error_log
You can just open any text file with console.app and it will add and keep it. Folder's though, no luck on that yet.
I was able to hardlink the files into ~/Library/logs by running:
ln /usr/local/var/logs/postgres.log ~/Library/logs
Notice the absence of -s.
No luck for directories though.
OSX Sierra 10.12.6
Just tried to do something similar.
I enter this in terminal, while the Console.app was running.
sudo mkdir -p /usr/local/var/log/apache2
sudo mv /private/var/log/apache2 /usr/local/var/log/apache2/apache2-old
sudo ln -s /usr/local/var/log/apache2 /private/var/log/apache2
Now whenever I open the Console.app it crashes.
Really wish there was a way of adding log files in the files. You CAN do it by dragging and dropping a folder onto the Console.app (given it a directory path as an argument), but the added folder only displays its immediate contents and doesn't allow for recursively descending into folders.
---------EDIT BELOW----------
Nevermind I stupidly did something like this leading to infinite recursion in Console.app
sudo mkdir -p /usr/local/var/log/apache2
sudo ln -s /private/var/log/apache2/apache2 /usr/local/var/log/apache2
sudo mv /private/var/log/apache2 /usr/local/var/log/apache2/apache2-old
sudo ln -s /usr/local/var/log/apache2 /private/var/log/apache2
I don't believe it's possible.
If you're generating log files, you should generate them into one of the standard locations anyway, so this won't be an issue.