Hot answers tagged

27

The problem is that those /proc files on Linux appear as text files as far as stat()/fstat() is concerned, but do not behave as such. Because it's dynamic data, you can only do one read() system call on them (for some of them at least). Doing more than one could get you two chunks of two different contents, so instead it seems a second read() on them just ...


14

The word boundary has a similar effect to -w, but can be used as part of the expression. ‘\b’ Match the empty string at the edge of a word. [...] ‘\<’ Match the empty string at the beginning of word. ‘\>’ Match the empty string at the end of word. To match bar only when it's the whole word, but foo anywhere (including inside ...


12

The ._ files are how OS X bsdtar handles OS X-specific extended attributes and resource forks. To keep them from being added to your tar files, you can pass COPYFILE_DISABLE=1 as an environment variable to tar. COPYFILE_DISABLE=1 tar cf newTar.tar /your/files


11

Clarification : This .exe file you downloaded is an installation file for Windows operating systems. You can install Google Chrome in Ubuntu this way, open a terminal and execute these commands: echo "deb http://dl.google.com/linux/chrome/deb/ stable main" | sudo tee /etc/apt/sources.list.d/google-chrome.list wget -q -O - ...


7

If you are interested in knowing why? this is so, you can see the answer in the kernel sources here: if (!data || !table->maxlen || !*lenp || (*ppos && !write)) { *lenp = 0; return 0; } Basically, seeking (*ppos not 0) is not implemented for reads (!write) of sysctl values that are numbers. Whenever a read is ...


7

Use perl: perl -pe 's/(?<=\[)(\d+)(?=\])/$1+1/ge' prova.txt Explanation: -p means loop over every line and print the result after every line -e defines the expression to execute on every line s/from/to/ does a simple substition s/(\d+)/$1+1/ge matches one or more digits, captures it into $1, and then the e modifier on the end tells perl that the ...


6

List all the files in the reverse order of their installation date into a file: rpm -qa --last >list You'll get lines like atop-2.1-1.fc22.x86_64 Wed Apr 13 07:35:27 2016 telnet-server-0.17-60.fc22.x86_64 Mon Apr 11 20:10:43 2016 mhddfs-0.1.39-3.fc22.x86_64 Sat Apr 9 21:26:06 2016 ...


6

Because chrome is not open source. Ubuntu (as most other Linux distributions) come with chromium instead, which is the open source project that chrome is based on. Because chrome isn't open and re-distributable, it can include some things that aren't really free but typically aren't hard to get (if you want them), I've read that in ubuntu (I use Debian) you ...


5

The -T option asks nodes (each hop) to insert a timestamp in the IP packets upon receiving a ping. It works by using the TS option of IP packets, specified by RFC791. ping -T requires one argument of tsonly, tsandaddr or tsprespec. tsonly returns only the timestamp. tsandaddr returns the timstamp and the address the packet was sent from. From the man ...


5

To organize the files by world: $ paste -d'\n' <(grep world1 file) <(grep world2 file) <(grep world3 file) <(grep world4 file) world1.com /randomkeygahjuh572/key639839 world2.com /randomkey788gauh72/key63whjk world3.com /randomkey788gauh72/key63whjk world4.com /randomkeyhghgdh778/key67567 world1.com ...


5

To my understanding, tar --exclude='._*' -cvf newTar . should work: Finder creates the ._* files but newTar shouldn't contain them. But you can completely bypass those files by invoking tar in passthrough mode. For example, to copy only the files from oldTar that are under some/path, use tar -cf newTar --include='some/path/*' @oldTar


5

ldconfig can list all the libraries it has access to. These libraries are also stored in its cache. /sbin/ldconfig -v -N will crawl all the usual library paths, list all the available libraries, without reconstructing the cache (which is not possible if you're a non-root user). It does NOT take into account libraries in LD_LIBRARY_PATH (contrarily to what ...


5

It's probably got its regular symbols stripped and what's left is its dynamic symbols, which you can get with nm -D.


5

The pipes connect the output or the left command to the input of the right command. This has nothing to do with the length of the stream. However, each command in the pipeline still has it's own buffering rules. If you don't trigger them in each command you won't see them on the final output.


5

That mark is internal and not included anywhere in the packet or any of its headers. That means it gets lost when doing the actual outbound connection, and wouldn't be visible in the INPUT table of the target server, but you would see it in the OUTPUT table of the initiating machine. The point of supporting a mark in ping is to allow outbound routing ...


5

If I code a application that has an X11 window, will it look and operate the same across linux os's Yes, but not really for the reason you might think. X11 is very low level, and concerns itself basically with drawing graphics primitives and providing a reasonably standardized (note that this does not mean sane; X11 can be called many things, but I ...


4

Creating a hardlink should probably be avoided, there's no need for one and a symlink is simpler and safer. Your other solutions are also fine though. You can create as script that calls the binary or you can add the directory to your PATH. The latter might be preferable if you expect to add other binaries in /opt as well. This is essentially a matter of ...


4

The meaning of %h in a config file should be documented in the corresponding program's man page. Here are some examples for %h: smb.conf - the Internet hostname that Samba is running on. date - same as %b (locale's abbreviated month name (e.g., Jan)) ssh_config - various (e.g. remote host name) sshd_config - home directory of the user being authenticated


4

Have the Tomcat processes replace /etc/issue with a non-warning version when they've finished (assuming you can include some of your own processing in those scripts). Or, have any script (/etc/rc.local?) run which replaces /etc/issue after everything has finished booting.


4

You can also try with yum history and usually you get a numbered list of what has been installed, like : [root@localhost ~]# yum history Loaded plugins: product-id, refresh-packagekit, subscription-manager Updating Red Hat repositories. ID | Login user | Date and time | Action(s) | Altered 3 | root <root> | ...


4

You could safely use ext3 with noatime option: then only actual file writes would touch your flash device in write mode. The ext3fs journal is a good thing in case of embedded system that may get lack of power suddenly. I personally run this way a few Raspberry PI's equipped with simple SD memory cards for a couple of years (24/7, not backed up by UPS and ...


4

You can go on the Google website and download the .deb package from this url : https://www.google.fr/chrome/browser/desktop/index.html The google website will auto-detect you're operating system here GNU/Linux, if not click on other platform and select "Linux" if will give you two options an RPM and a DEB package, as you run Ubuntu, you will choose the "64 ...


4

The reason it doesn't run is because .exe files are designed for Windows, and won't run on Ubuntu without using Wine or a VM. So you downloaded the wrong file. You need to get the Linux version. You're looking for the file that ends with .deb. Here is a link to the file you need: Please note that this will only work if you have a 64-bit version of Ubuntu, ...


4

That's basically a duplicate of my answer on SO. However, since nobody mentioned the stdbuf command here, I felt like I should add that here as well. =============== Basically a process that reads from a pipe can consume the data byte by byte as soon as they are available in the pipe. However, as long as the programs are using std io functions of the libc, ...


4

This is referring to the fact that Linux (like all Unix-style systems) exposes most of the resources it manages through objects which look like files: /dev-style devices, /proc and /sys entries... In the context of your quote, this property is mentioned because it allows access permissions to be reasoned about in a consistent fashion.


4

You're looking in the wrong place, because this isn't really to do with the mount command itself. What you're doing is mounting a special filesystem, in this case, a cgroups hierarchy, and the options happen to be how you attach different cgroup subsystems like cpu or memory. Red Hat* has some good documentation on cgroups in general and the mount options ...


4

You could also use awk: awk -F '[\\[\\]]' '{if ($2) { sub($2, $2 + 3)}} 1' prova.txt In fact, this can be slightly shortened to: awk -F '[\\[\\]]' '$2 { sub($2, $2 + 3)} 1' prova.txt


4

awk solution. awk '{if(NR>1){$1="";sub(" ","")}}1'


3

To debug problems with scheduling or applications performance on Linux, it is a good start to run task under perf stat. It reports statistics about the processor pipeline, its stalled cycles, or memory behaviour. Possible problems: Linux/Scheduler bug Intel HT is not keeping up with your threads Memory is not able to provide enough data for the program ...


3

I think mount does not support this use of user with the default fuse security setting (or allow_root). I think the resulting permissions are the same as if you used sudo mount. To allow access by multiple non-root users, you could set allow_other, allowing access by any user. If this raised concerns, it would be possible to set default_permissions to ...



Only top voted, non community-wiki answers of a minimum length are eligible