tcpdump not setting paths correctly [duplicate] - bash

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
How to edit PATH variable on mac (Lion). I cannot find any file where I can add paths. can someone guide me about it?
Whats the file name? .profile or .bash_profile???
and where I can find it?
I have tried
echo 'export PATH=/android-sdk/tools:$PATH' >> ~/.profile

Open and edit /etc/paths using any text editor.
$ sudo vi /etc/paths
(editing text files with vi)
Note: each entry is separated by a new line
/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin
Save and close the file. Then restart your terminal.

Based on my own experiences and internet search, I find these places work:
/etc/paths.d
~/.bash_profile
Note that you should open a new terminal window to see the changes.
You may also refer to this this question

environment.plst file loads first on MAC so put the path on it.
For 1st time use, use the following command
export PATH=$PATH: /path/to/set

You could try this:
Open the Terminal application. It can be found in the Utilities directory inside the Applications directory.
Type the following: echo 'export PATH=YOURPATHHERE:$PATH' >> ~/.profile, replacing "YOURPATHHERE" with the name of the directory
you want to add. Make certain that you use ">>" instead of one ">".
Hit Enter.
Close the Terminal and reopen. Your new Terminal session should now use the new PATH.
Quoted from ketio.me tutorial (archived copy).

use
~/.bash_profile
or
~/.MacOSX/environment.plist
(see Runtime Configuration Guidelines)

Related

How to change default directory in Bash for Windows 10? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 5 years ago.
Improve this question
How can I change the default directory of windows bash to a folder of my choosing?
EDIT: I guess I should have been more clear. When I startup Bash I want it the directory to be in a location of my choosing like Desktop or something. How do I go about setting a default directory?
If you want change the directory your bash prompt is starting in, you can edit your .bashrc file. At the bottom, add:
cd ~
This will go into your home directory. (you can actually do just cd, but I it's clearer to add the ~ IMO)
To edit, you can use vim. If you don't know how to use it, you can always use nano for the time being, but you really should have a look at it, it's really powerful.
$ nano ~/.bashrc
This will open nano in "full console". At the bottom, you have the few commands you can use (^ means control) Do your changes, hit ctrl+o to save the file (write the file). It'll ask you where to write, by default, it's the right location, just hit enter and the .bashrc file will be saved. Then, you can press ctrl+x to exit.
Steps to set default directory for Bash on Ubuntu on Windows to a folder -
Open Bash on Ubuntu on Windows.
cd ~ to go to home directory of Ubuntu
Type edit .bashrc and enter at the Bash. This will open the file in vim.
Use Down Arrow or Page Down key on keyboard to go to the end of the file (there's a helpful progress bar at the bottom right corner of the Bash). At the end of this file, you will find cd ~, replace cd ~ with your desired location.
Save the .bashrc file. To save the file, click esc and then type :wq and click enter.
Note:
To access your hard disk location make sure you include the mount directory first.
So if want your Bash to open at C:\dev whenever you open the Bash. You need to replace the cd ~ with cd /mnt/c/dev at .bashrc file at Ubuntu home directory.
Just enter echo "cd ~" >> ~/.bashrc. This will append "cd ~" to your .bashrc.
.bashrc is executed everytime you start a(n interactive) bash instance.

please help me out with mac OS 10.11 terminal commands [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 6 years ago.
Improve this question
I'm new to using mac. Could someone please help me out with the terminal commands?
cd to jump into folders right?
i tried this but it isn't working for a folder in my desktop.
Basically, I want to enter a folder on my dekstop and then go to another folder inside that. how do i do it?
The Terminal starts in your HOME folder normally. So, type
ls
to list the files and you will see the same folders and files you see when you go to HOME in the Finder. So, you will see Desktop, so now type
cd Desktop
ls
and you will see all the folders and files on your desktop. If you want to go into one called Freddy Frog now, you will need to put double quotes around it to make sure the space between Freddy and Frog is kept and it doesn't think you want to go to a folder called Freddy then one called Frog. so type
cd "Freddy Frog"
ls
and you can now go to the "Spiders from Mars" directory in there with
cd "Spiders from Mars"
ls
In general, you can just start typing the name of the folder you mean and press TAB and it will guess what you mean. So, if you start a new Terminal and type:
ls
you will see the files in your Home directory. Now type:
cd Desk<TAB>
and it will show you what it guesses you mean. That's called filename completion. If you want to know where you are currently located, use:
pwd
which will print the working directory.
If you want to return to your HOME directory at any time, just type:
cd
Two other tips for you if you are learning your way around...
Firstly, if you want Finder to open and display the directory you are currently in in the Terminal, you can run:
open .
Secondly, when Finder opens, you can turn on the Path bar at the bottom of the window by typing:
Command+Option+P
I have shown it in red - no idea why Apple ships with it turned off by default - probably explains why most Mac users I have met generally have no idea where their files are and don't know the difference between copying and moving files!
To change directory to say /usr , the command should be cd /usr
i.e. cd followed by the absolute path of the directory. For relative paths use cd ./usr where the directory usr is in your current directory.This link gives complete documentation of cd command.
Use the change directory command:
using relative paths cd ./relative/path/to/directory
using absolute paths cd /absolute/path/to/directory
IMPORTANT: do not to forget the space after cd and before the path!!!!!
On Windows, the space isn't needed for some reason...

Find string within hidden file on OS X [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
I am trying to find text within one of bash's setup files on my mac (10.9.2).
I know the text "PIP_RESPECT" is in .bash_profile
I tried Find Any File, which apparently does not search within files.
I rebuilt my spotlight index.
I tried a finder search with visibility set to invisible, with no luck
I tried the following terminal commands:
mdfind "PIP_RESPECT"
mdfind *PIP_RESPECT*
mdfind "*PIP_RESPECT*"
mdfind '"*PIP_RESPECT*"'
which return nothing.
mdfind 'kMDItemTextContent == "*PIP_RESPECT*"cd'
which returns:
~/Library/Application Support/Firefox/Profiles/6wjt9c4s.default/sessionstore.js
which is clearly not the .bash_profile.
So what am I doing wrong?
Thank you for all your responses:
I am just trying to find the text "VIRTUALENVWRAPPER_PYTHON," if it exists, in any file, by any means.
I listed all the things I tried.
# stakolee:
$ grep 'PIP_RESPECT' ~/.bash_profile return in the terminal
returned:
~/.bash_profile:export PIP_RESPECT_VIRTUALENV=true
grep: return: No such file or directory
grep: in: No such file or directory
grep: the: No such file or directory
grep: terminal: No such file or directory
so the top return is what I want, thank you. I would give you a check mark, but it does not seem to allow check marks in comments.
#Mark Setchell
Easy Find finished a lot faster, but you have made me realize I need to learn more about grep.
I awarded the checkmark to:
# Thomas Tempelmann "find any file guy": sorry, I didn't mean to dis your app, but the Easy Find app did work, after i changed the settings to scan all files
I clearly have more to learn, thank you all, again.
I am not sure from your question if you are trying to say "How do I make Spotlight find a file?" or "I want to find a file containing PIP_RESPECT and I don't care how".
If the second, you can search through every file on your Mac from the terminal like this:
sudo find / -type f -exec grep PIP_RESPECT {} /dev/null \; 2> /dev/null
It will take some time to run! It says... starting at the root (top) of the filesystem, find everything that is a file (not directory) and look in every file (with grep) and see if you can find PIP_RESPECT and print the name of the file if you can and throw away error messages.
If you only want to search in your own login directory and below, it will be quicker and easier to do this (thanks to #I'L'I):
find ~ -type f -exec ....
Author of Find Any File here.
I tried Find Any File, which apparently does not search within files.
Right, it doesn't. But it documents that clearly both on the web page. May I quote:
Contrary to Spotlight, [...], but not for file content (use Spotlight or EasyFind for that).
And if you read a bit further down:
Alternatives to Find Any File
If you like to search for data inside files, and Spotlight doesn't do it for you, have a look at EasyFind by DEVONtechnologies [...]
If you want to search for specific text in a large set of files inside a directory, I recommend TextWrangler.
Also, the reason why Spotlight (including mdfind) doesn't find anything is that Spotlight implicitly ignores anything in the System folders. It won't ever find anything in there.
Hope that helps.

Setting an environment variable in Mac OSX 10.8 [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I feel quit stupid asking this, but I am completely unable to set an environment variable in Mac OSX 10.8.
I'd greatly appreciate some specific instructions on which files to edit, what is the syntax to place in the file, etc.
I am trying to do some web development using Arc, which requires racket. I am getting an error from arc that 'racket' isn't a recognized command. I am only able to run racket commands when I am in Racket's bin directory (here is the location of my racket directory - /Applications/Racket v5.3.3/), which suggests to me that an environment variable has not yet been created for racket (but I could be wrong).
Thanks in advance.
Have you tried editing your profile? If you are using bash, edit the .bash_profile file in your home dir. You will have to insert a line like this:
export PATH="$PATH:/Applications/Racket\ v5.3.3"
You have to add the path to Racket's bin/ directory to the PATH environment variable. Open the file ~/.bash_profile using your text editor of choice, look for a line that looks similar to this (the <paths> part is just a placeholder for the real paths) , if it doesn't exist, just add it:
PATH=$PATH:<paths>
At the end, add a : and the path to Racket's bin/ directory, something like this:
PATH=$PATH:<paths>:/Applications/Racket\ v5.3.3/bin
Replace the v5.3.3 version number with the appropriate version of your installation. Finally, make sure that this line appears somewhere in the file:
export PATH
Save it, and you're ready to go!

Cannot edit bash_profile on Mac OsX [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I am using MacOSX Snow Leopard 10.6.8.... I am the only user on this machine and I should be admin.
I trying to edit my bash_profile to give it this simple alias:
alias server=' open http://localhost:8000 && python -m SimpleHTTPServer'
however when I use the terminal and type: vim ~/. bash_profile and paste in this alias I get message saying I cant save due to permissions.
So then I show all hidden files and go to fix the permissions on this file but the file is all grayed out.... I cant change anything. What can I do??
You need to open it with sudo.
sudo vim ~/.bash_profile
The file appears greyed-out when you show hidden files because Mac OS X displays hidden files as greyed out so you can differentiate them from non-hidden files. You should still be able to edit the permissions on the file (you don't need to, though).
If you want to be able to edit without being root, you can change the owner of the file.
sudo chown your_user_name ~/.bash_profile

Resources