The ~ (tilde) can have different meanings: it can be an operator, performing a bitwise negation on a binary number - all 1 bits are set to 0 and all 0 bits are set to 1. It can also simply be the tilde character itself, as used in Windows for shortening long path names.
Questions tagged [tilde]
171 questions
190
votes
19 answers
How to manually expand a special variable (ex: ~ tilde) in bash
I have a variable in my bash script whose value is something like this:
~/a/b/c
Note that it is unexpanded tilde. When I do ls -lt on this variable (call it $VAR), I get no such directory. I want to let bash interpret/expand this variable without…

madiyaan damha
- 2,917
- 5
- 21
- 15
187
votes
6 answers
What does the tilde before a function name mean in C#?
I am looking at some code and it has this statement:
~ConnectionManager()
{
Dispose(false);
}
The class implements the IDisposable interface, but I do not know if that is part of that the tilde(~) is used for.

Keith Sirmons
- 8,271
- 15
- 52
- 75
147
votes
4 answers
What does a tilde in angle brackets mean when creating a Java generic class?
I was reading through some JMockit examples and found this code:
final List actualItems = new ArrayList<~>();
What does the tilde in the generic identifier mean? I know it's the unary bitwise NOT operator, but I don't see an operand…

Michael K
- 3,297
- 3
- 25
- 37
137
votes
3 answers
Why does ~True result in -2?
In Python console:
~True
Gives me:
-2
Why? Can someone explain this particular case to me in binary?

lukaszkups
- 5,790
- 9
- 47
- 85
63
votes
1 answer
In R formulas, why do I have to use the I() function on power terms, like y ~ I(x^3)
I'm trying to get my head around the use of the tilde operator, and associated functions. My 1st question is why does I() need to be used to specify arithmetic operators? For example, these 2 plots generate different results (the former having a…

ChrisW
- 4,970
- 7
- 55
- 92
56
votes
2 answers
What does symbol tilde (~) mean in CSS
I want to know what does (~) mean in css.
#img1:hover ~ #img2 {
opacity: 0;
}
In visual studio, i get 'unexpected character sequence' error when i use this symbol. what is the actual meaning of this in CSS. what does it do?

Monie corleone
- 1,618
- 1
- 16
- 37
48
votes
5 answers
what is the use of "~" tilde in url?
what is the use of ~ tilde in URL?
I am using cPanel, and have link including tilde, why is tilde there?
When we buy server space but do not have dns or don't want to use it for development purposes,we use the like http://serverip/~foldername.

amolv
- 978
- 1
- 8
- 20
39
votes
10 answers
Tilde not recognized in Mac terminal
I have this weird situation on my Mac running OSX Lion where the ~ (tilda) does not go to my user directory. Instead when I type "cd ˜", I get:
-bash: cd: ˜: No such file or directory
Any advice on how to fix this?

rasheqrahman
- 511
- 1
- 4
- 5
38
votes
3 answers
What does the tilde (~) in macros mean?
Seen on this site, the code shows macro invocations using a tilde in parentheses:
HAS_COMMA(_TRIGGER_PARENTHESIS_ __VA_ARGS__ (~))
// ^^^
What does it mean / do? I suspect it to just be an empty argument,…

Xeo
- 129,499
- 52
- 291
- 397
28
votes
3 answers
What's the function of the ~ bitwise operator (Tilde)
Possible Duplicate:
What does this ~ operator mean here?
Bit not operation in PHP(or any other language probably)
Can someone explain me the ~ operator in PHP? I know it's a NOT-operator, but why does PHP convert following statement to the…

Michiel
- 7,855
- 16
- 61
- 113
23
votes
1 answer
What is meaning of first tilde in purrr::map
I was looking at this example that uses map. Here it is:
mtcars %>%
split(.$cyl) %>% # from base R
map(~ lm(mpg ~ wt, data = .))
What is the meaning of the first tilde in map(~ lm...? That is, how does R interpret the first tilde? (I understand…

CPak
- 13,260
- 3
- 30
- 48
23
votes
6 answers
Difference between ./ and ~/
When creating filepaths and URLs, I noticed that many times the path starts with ./ or ~/.
What is the difference between filepaths that start with ./ and ~/?
What do each of them mean?

Tot Zam
- 8,406
- 10
- 51
- 76
23
votes
2 answers
The Not Equal Tilde in bash
Like presented in the title,
What's the opposite of "=~" operator?
I really googled for that and I fund just the following solution: [[ ! $str1 =~ $str2 ]]
Is there any operator that verify the opposite of "=~" operator?
Thanks.

Armageddon
- 371
- 1
- 2
- 7
19
votes
7 answers
Applications of '~' (tilde) operator in Python
I just discovered the bitwise complement unary operation in Python via this question and have been trying to come up with an actual application for it, and if not, to determine if it's generally safe to overload the operator (by overriding the…

Alec
- 1,399
- 4
- 15
- 27
19
votes
1 answer
The meaning of tilde in Haskell types (Type equality)
I've been messing around with the fix function, and I happened across this:
λ let fix f = let x = f x in x
λ fix (+)
:15:5:
Occurs check: cannot construct the infinite type: t ~ t -> t
Expected type: t -> t
Actual type: t…

AJF
- 11,767
- 2
- 37
- 64