Most Popular

1500 questions
80
votes
10 answers

How to turn off color with `ls`?

It is normally nice to have color output from ls, grep, etc. But when you don't want it (such as in a script where you're piping the results to another command) is there a switch that can turn it off? ls -G turns it on (with some BSD-derived…
iconoclast
  • 9,057
  • 12
  • 56
  • 95
80
votes
7 answers

Allowing a regular user to listen to a port below 1024

I need to allow a non-root user to run a server listening on port tcp/80. Is there any way to do this?
peoro
  • 3,658
  • 3
  • 32
  • 32
79
votes
5 answers

How to export variables that are set, all at once?

set command displays all the local variables like below. How do I export these variables all at once? >set a=123 b="asd asd" c="hello world"
Neerav
  • 2,915
  • 3
  • 15
  • 7
79
votes
10 answers

Create and format exFAT partition from Linux

Is it possible to create and format an exFAT partition from Linux?
Sean
  • 1,045
  • 1
  • 8
  • 8
79
votes
2 answers

What units of time does "top" use?

If I issue the "top" command and receive results such as: PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 00001 bob 25 0 77380 1212 1200 R 95.8 0.0 89122:13 fee 00002 bob 25 0 77380 1196 1184 R 95.4 0.0 …
Abe
  • 1,681
  • 2
  • 13
  • 8
79
votes
4 answers

How to pass a string to a command that expects a file?

Suppose a program cook takes one argument: the pathname of a text file containing the recipe of the food to cook. Suppose I wish to call this program from within a bash script, also suppose I already have the recipe in a string…
Flux
  • 2,516
  • 4
  • 20
  • 45
79
votes
3 answers

What is a "loop device" when mounting?

I am mounting an ISO file, and looking at this tutorial. They use the command: $ mount -o loop disk1.iso /mnt/disk I'm trying to understand the use of -o loop. I have two questions: When I look at the long man page for mount, it takes time to find…
Vass
  • 5,271
  • 9
  • 38
  • 45
79
votes
3 answers

Is $() a subshell?

I understand the subshell syntax to be (), is $() just a subshell that you can retrieve variable values from? Note: This applies to bash 4.4 based on different wording in their documentation.
leeand00
  • 4,443
  • 10
  • 51
  • 78
79
votes
6 answers

How to get permission number by string : -rw-r--r--

I need to set the same chmod, how to get number for -rw-r--r-- ?
cnd
  • 1,893
  • 5
  • 18
  • 28
79
votes
4 answers

Cygwin has no watch command?

I installed Cygwin on my Windows XP to use some of its commands. Now I what to check a file every 2 minutes and want to use watch for this purpose but I see that Cygwin has no such command. Is this really true? what can I do instead?
ethan
  • 819
  • 1
  • 7
  • 6
79
votes
1 answer

How to set ulimits on service with systemd?

How would you set a ulimit on a systemd service unit? This stackoverflow question explains that systemd ignores system ulimits What would the syntax look like to set the following ulimits? ulimit -c ulimit -v ulimit -m [Unit] Description=Apache…
spuder
  • 17,643
  • 36
  • 91
  • 119
79
votes
15 answers

Checking if HyperThreading is enabled or not?

How can I check if hyperthreading is enabled on a Linux machine, using a perl script to check for it? I'm trying the following way: dmidecode -t processor | grep HTT Let me know if I'm on right track.
doubledecker
  • 1,807
  • 3
  • 15
  • 12
79
votes
12 answers

How to run a script on screen lock/unlock?

I'd like to run a script if the Gnome session is locked and unlocked. Is there a way that I can intercept this and perform certain actions when the desktop is locked or unlocked?
Naftuli Kay
  • 38,686
  • 85
  • 220
  • 311
79
votes
2 answers

How to change default new window directory from within the tmux

I recently moved from GNU screen to tmux. I find it quite similar but with bigger support (I switched due to problem with escape-time in neovim- resolution was only for tmux). Unfortunately in tmux I'm unable to find a similar command to…
lewiatan
  • 1,099
  • 2
  • 11
  • 15
79
votes
5 answers

Difference between "cat" and "cat <"

I was working through a tutorial and saw use of both cat myfile.txt and cat < myfile.txt. Is there a difference between these two sequences of commands? It seems both print the contents of a file to the shell.
rookie
  • 833
  • 1
  • 6
  • 6