Most Popular

1500 questions
92
votes
5 answers

How to run time on multiple commands AND write the time output to file?

I want to run time command to measure time of several commands. What I want to do is: Use the time command to measure the time it takes to run multiple commands together Write only the time output to a file Write the stderr of all commands I am…
Karel Bílek
  • 1,859
  • 5
  • 20
  • 26
92
votes
3 answers

Print size of directory content with tree command in tree 1.5?

I like tree it's a nice way to display my files and the size of folders/directories. But the -h option only shows the size of the directory, not the cumulative size of its contents. /media/ ├── [ 16K] 64D9-E862 │   ├── [8.0K] downloads I know for…
AncientSwordRage
  • 1,714
  • 1
  • 20
  • 26
92
votes
7 answers

Can I pipe stdout on one server to stdin on another server?

stdout on one CentOS server needs to be piped to stdin on another CentOS server. Is this possible? Update ScottPack, MikeyB and jofel all have valid answers. I awarded the answer to Scott because, even though my question didn't specify security as a…
Wesley
  • 13,963
  • 12
  • 35
  • 49
92
votes
17 answers

How to check if a pipe is empty and run a command on the data if it isn't?

I have piped a line in bash script and want to check if the pipe has data, before feeding it to a program. Searching I found about test -t 0 but it doesn't work here. Always returns false. So how to be sure that the pipe has data? Example: echo…
zetah
  • 1,997
  • 4
  • 20
  • 21
92
votes
6 answers

Is it possible to mount a gzip compressed dd image on the fly?

I like to create an image backup the first time I'm backing up a system. After this first time I use rsync to do incremental backups. My usual image backup is as follows: Mount and zero out the empty space: dd if=/dev/zero of=temp.dd bs=1M rm…
g19fanatic
  • 1,023
  • 1
  • 9
  • 14
92
votes
2 answers

What are the differences between the various partition tables?

When I am looking to create a new partition table, I have the following options: aix amiga bsd dvh gpt mac msdos pc98 sun loop The default in gparted appears to be msdos which I guess is an 'MBR' partition table. However gpt is more recent, but…
user168419
92
votes
6 answers

Execute shell commands in Python

I'm currently studying penetration testing and Python programming. I just want to know how I would go about executing a Linux command in Python. The commands I want to execute are: echo 1 > /proc/sys/net/ipv4/ip_forward iptables -t nat -A PREROUTING…
Xanmashi
  • 1,053
  • 1
  • 8
  • 10
92
votes
5 answers

How do I recursively delete directories with wildcard?

I am working through SSH on a WD My Book World Edition. Basically I would like to start at a particular directory level, and recursively remove all sub-directories matching .Apple*. How would I go about that? I tried rm -rf .Apple* and rm -fR…
codedog
  • 1,023
  • 1
  • 7
  • 5
92
votes
4 answers

Why are network interfaces not in /dev like other devices?

I'm mostly curious, but why aren't network interfaces in /dev? Are there any other kinds of devices that aren't represented as a node under /dev?
andyortlieb
  • 1,021
  • 1
  • 7
  • 6
92
votes
5 answers

tar exits on "Cannot stat: No such file of directory", why?

I'm trying to create tar.gz file using the following command: sudo tar -vcfz dvr_rdk_v1.tar.gz dvr_rdk/ It then start to create files (many files in folder), but then I get the following error: tar: dvr_rdk_v1.tar.gz: Cannot stat: No such file or…
ransh
  • 1,397
  • 2
  • 10
  • 19
92
votes
10 answers

GTK - Enable/set dark theme on a per-application basis

Is there a way to set gtk-application-prefer-dark-theme for an application? This is normally set in the code by the application. Apps such as Eye of Gnome and Totem turn it on. I want to, as a user turn it on, on a per application bases. For…
Gary van der Merwe
  • 1,630
  • 2
  • 14
  • 28
92
votes
4 answers

Why use install rather than cp and mkdir?

I've seen in many places used install -d to create directories and install -c to copy a file. Why not use mkdir and cp? Is there an advantage in using install?
Neaţu Ovidiu Gabriel
  • 1,049
  • 1
  • 7
  • 7
92
votes
5 answers

Get common name (CN) from SSL certificate?

I have a SSL CRT file in PEM format. Is there a way that I can extract the common name (CN) from the certificate from the command line?
Naftuli Kay
  • 38,686
  • 85
  • 220
  • 311
91
votes
5 answers

i3wm : start applications on specific workspaces when i3 starts

How can I start applications on specific workspaces in i3 when it starts? Why is this not working in my config file? : workspace 1; exec firefox; workspace 2; exec chromium; workspace 1
Gradient
  • 3,579
  • 10
  • 31
  • 37
91
votes
8 answers

Connect to a Bluetooth device via Terminal

I'm using Mint 15 w/ Cinnamon. I bought a set of bluetooth speakers and I'm trying to connect to them via terminal. Via the GUI I can see them normally and I am connected to them. I want to make a small script so every time they are visible I would…
Zippie
  • 1,799
  • 2
  • 13
  • 14