48
votes
What does `>>` mean in terminal command?
Short answer — what does >> do?
With >>, you append the output of a command to a file.
Your example command consists of several parts, basically:
command >> filename
So the output of ...
31
votes
Accepted
What does `>>` mean in terminal command?
It redirects the stdout of the program before >> and appends it to the given file after.
28
votes
Difference between .bashrc and .bash_profile
Have a look at this excellent blog post by ShreevatsaR. Here's an extract, but go to the blog post, it includes an explanation for terms like "login shell", a flow chart, and a similar table for Zsh.
...
13
votes
bash how to remove "__bp_precmd_invoke_cmd" error?
Using an editor such as nano or vim,
Add the line
unset PROMPT_COMMAND
to your .bashrc file, and it will take effect on the next session.
To apply the change immediately for the life of the ...
13
votes
Accepted
`ssh <host>` is a login shell, but `ssh <host> <command>` is not?
OpenSSH (most likely what you're running) decides whether or not to create a login shell, and it only does so if you are not running a specific command. From man ssh:
If command is specified, it is ...
11
votes
Difference between .bashrc and .bash_profile
A BETTER COMMENT FOR THE HEAD OF /ETC/PROFILE
Building on Flimm's great answer above, I inserted this new comment at the head of my Debian /etc/profile, (you might need to adjust it for your distro.):
...
11
votes
Visual studio code integrated terminal path different than normal terminal
In Visual Studio Code open Settings (JSON) from the command palete (⇧⌘P), and at the end of the file add the following
"terminal.integrated.env.osx": {
"PATH": ""
}
Restart VSCode and you ...
10
votes
Difference between .bashrc and .bash_profile
The configuration logic of bash's itself is not crazy complicated and explained in other answers in this page, on serverfault and in many blogs. The problem however is what the Linux distributions ...
9
votes
How can I fix a Broken Pipe error?
Let's try with yes, an endless process printing yes...
Before, the yes process was killed by SIGPIPE when reached limit.
➜ set -o pipefail
➜ yes | head -n 1
y
➜ echo $?
141
My solution
➜ ...
9
votes
Accepted
Win10: VS Code integrated bash not loading ~/.bash_profile
Turns out, that it had to do in how the terminal is started. The git bash one (in its own window) is using the login to start and hence reads .bash_profile.
The one in vs code is started not in the ...
7
votes
~/.profile is not loaded when using SSH (Ubuntu)
You probably have a ~/.bash_profile, which overrides ~/.profile.
7
votes
Accepted
How to load parts of bash alias only when logging in via ssh
In .bashrc (or where you define the aliases), you can make it conditional based on the variable SSH_CONNECTION, which is set only for ssh connections. For example:
if [[ $SSH_CONNECTION == *"your-IP"*...
7
votes
What does `>>` mean in terminal command?
For the TLDR people who just like to see an example;
The standard output (not errors) of the command before the >> will get added to the end of the file named after it.
So if file "flintstones.txt" ...
7
votes
How to read excel using Powershell
In Powershell, you can use the great ImportExcel module to handle all sorts of excel data:
# First-time setup, install the module:
Install-Module ImportExcel
# Import the module:
Import-Module ...
5
votes
Accepted
.bashrc running an alias without my approval: fatal: Not a git repository (or any of the parent directories): .git
The specific subcommand style doesn't make any difference – either way, as long as they're within double quotes, they'll be expanded at the time the 'alias' line is interpreted. To avoid that, either ...
5
votes
How do I modify my Git Bash profile in Windows?
My git version is git version 2.18.0.windows.1
It took me a while to figure out where the .bashrc was
C:\Program Files\Git\etc ---> bash.bashrc
hope it helps
5
votes
How to reset Bash on Mac OSX, .bash_profile corrupted and bash no longer works
I was running on the same problem, and I just found simpler solution:
/usr/bin/nano .bash_profile
delete all your mess, then save the file
5
votes
Win10: VS Code integrated bash not loading ~/.bash_profile
You can try adding to the settings: "terminal.integrated.shellArgs.windows": ["-l"],
As an alternative you can use the .bashrc file instead of .bash_profile.
5
votes
Visual studio code integrated terminal path different than normal terminal
You can uncheck Terminal › Integrated: Inherit Env option, which can be searched by terminal.integrated.inheritEnv, in Visual Studio Code Settings like the following image:
Referece: https://github....
5
votes
Git Bash extremely slow start up on Windows
In my case I was using MING64 with Git bash for Windows. It took a solid 15 seconds to load every window. It turns out the .bashrc in %USERPROFILE% was the culprit.
I had NVM installed on my system ...
4
votes
`ssh <host>` is a login shell, but `ssh <host> <command>` is not?
The why of this behavior lies at a lower level than shells: ssh host (the "login shell" case) uses a pseudoterminal on the remote host, to communicate between the sshd server process and the shell; ...
3
votes
How can I fix a Broken Pipe error?
The write error: Broken pipe message refers to a writing process that tries to write to a pipe with no readers left on the reading end of that pipe and the special circumstance that the SIGPIPE signal ...
3
votes
Accepted
Screwed up PATH in ~/.bash_profile, now cannot edit it
/bin/nano ~/.bashrc
or
/usr/bin/emacs ~/.bashrc
or
/usr/bin/vim ~/.bashrc
3
votes
.bashrc not automatically initalising?
I'm not sure if I understand your questions but:
Your bash init files should be sourced at boot. If not your system is badly configured or broken.
You didn't mention your Operating System, but I'm ...
3
votes
Can't export variable in .bash_profile ubuntu 18.04
For your reference:
Below is login shell startup file processing diagram for different shells
(Credit for diagram is going to Shantanu Kulkarni who posted it in yEd gallery)
2
votes
MinGW Bash profile
Along the lines of @Koshmarr, but slightly different. My mingw64, downloaded from git-scm.com, would load /c/Users/[user-name] on startup. Yet my home drive (found by cd ~) was in /h/. I put a .bashrc ...
2
votes
Accepted
Execute same command for each non-interactive bash session
To make bash parse a file when invoked as a non-interactive shell, you need to set the environment variable BASH_ENV to point to that file. From man bash (section on INVOCATION):
When bash is ...
2
votes
How can you remove duplicates from bash history?
Many more ways to do this here as well as some other ongoing settings / options:
https://unix.stackexchange.com/questions/48713/how-can-i-remove-duplicates-in-my-bash-history-preserving-order
Also
...
2
votes
How can you remove duplicates from bash history?
I've created a small Python script deduplicate.py for this. If a line is duplicated, the script only keeps the last duplicate. This works nicely when searching the command history with fzf using Ctrl+...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
.bash-profile × 166bash × 99
macos × 45
terminal × 34
bashrc × 33
linux × 24
command-line × 13
shell × 13
path × 12
alias × 10
ssh × 9
ubuntu × 8
unix × 8
mac × 7
bash-alias × 7
terminal.app × 6
windows × 5
bash-scripting × 5
homebrew × 5
git × 4
zsh × 4
osx-lion × 4
ruby × 4
rvm × 4
powershell × 3