Most Popular
1500 questions
140
votes
6 answers
difference between "function foo() {}" and "foo() {}"
I can define bash functions using or omitting the function keyword. Is there any difference?
#!/bin/bash
function foo() {
echo "foo"
}
bar() {
echo "bar"
}
foo
bar
Both calls to functions foo and bar succeed and I can't see any difference.…
Carlos Campderrós
- 2,041
- 2
- 16
- 18
140
votes
10 answers
File permission issues with shared folders under Virtual Box (Ubuntu Guest, Windows Host)
I am using Ubuntu on Virtual Box and I have a folder which is shared between the host (Windows) and the VM (Ubuntu). When I open any file in the share folder in Ubuntu, I can not change it as its owner is set to root.
How can I change the ownership…
user654019
- 2,277
- 4
- 21
- 20
140
votes
7 answers
Why is cd not a program?
I've always wondered why cd isn't a program, but never managed to find the answer.
Anyone know why this is the case?
AkshaiShah
- 3,599
- 5
- 18
- 9
140
votes
6 answers
How to pass parameters to an alias?
For bash script, I can use "$@" to access arguments. What's the equivalent when I use an alias?
prosseek
- 8,418
- 16
- 47
- 43
140
votes
4 answers
How do I pass a list of files to grep
I am using find and getting a list of files I want to grep through. How do I pipe that list to grep?
Tegra Detra
- 4,908
- 11
- 39
- 53
139
votes
8 answers
What is the need for `fakeroot` command in linux
Why do we need fakeroot command at all? Can't we simply use the sudo or su commands?
The man page says:
fakeroot - run a command in an environment faking root privileges for file manipulation
About.com says:
Gives a fake root environment. This…
gkt
- 1,563
- 2
- 11
- 7
139
votes
9 answers
Which installed software packages use the most disk space on Debian?
Disk space on my root partition is running low, so I want to delete some applications from the system. How can I see which software packages use the most disk space? Is it possible to view that from aptitude?
I know about generic disk space…
Mirzhan Irkegulov
- 8,248
- 11
- 45
- 54
139
votes
11 answers
How to follow links in linux man pages?
Is there a way to follow the links mentioned in a man page? For example, here's the man page for ps; how do I access the underlined link circled in red in the screenshot: top(1)?
its_me
- 13,709
- 23
- 54
- 52
138
votes
11 answers
How do I know if a partition is ext2, ext3, or ext4?
I just formatted stuff. One disk I format as ext2. The other I want to format as ext4. I want to test how they perform.
Now, how do I know the kind of file system in a partition?
user4951
- 10,329
- 28
- 71
- 92
138
votes
7 answers
What is /usr/local/bin?
Before today, I've used the terminal to a limited extent of moving in and out of directories and changing the dates of files using the touch command. I had realised the full extent of the terminal after installing a fun script on Mac and having to…
JFW
- 2,137
- 3
- 15
- 11
138
votes
10 answers
Keyboard set to "cat mode"
I am a cat-owner and a cat-lover. But I don't like it when my cat sits on my keyboard and pushes randoms keys and messes everything up.
I have an idea to have a function key that turns off the keyboard (except for one special key combination). I…
psitae
- 1,481
- 2
- 9
- 7
138
votes
1 answer
How to prettyprint json using jq standalone?
Currently, when I want to pretty-print a json file using jq, I use:
cat file.json | jq .
Yet I would expect for jq to accept a file name as argument without having to fallback on cat.
The man page says:
jq [options...] filter [files...]
...
By…
k0pernikus
- 14,853
- 21
- 58
- 79
138
votes
16 answers
How to connect to a serial port as simple as using SSH?
Is there a way to connect to a serial terminal just as you would do with SSH? There must be a simpler way than tools such as Minicom, like this
$ serial /dev/ttyS0
I know I can cat the output from /dev/ttyS0 but only one way communication is…
norq
- 4,034
- 4
- 20
- 18
137
votes
9 answers
In linux, how to delete all files EXCEPT the pattern *.txt?
I know how to delete all txt file under current directory by rm *.txt.
Does anyone know how to delete all files in current directory EXCEPT txt file?
Firegun
- 1,829
- 3
- 15
- 9
137
votes
5 answers
Why isn't Linux embraced as the official GNU kernel?
While I knew for quite some time the existence of Hurd, and its mission as the official GNU Operating System kernel, I was wondering how come Linux is not embraced as the official GNU kernel over the years, seeing as it is in a much better state…
NlightNFotis
- 7,525
- 7
- 32
- 38