Tag Info

Hot answers tagged

31

You can. You just have to set the executable bit on the /a/b directory. That will prevent being able to see anything in b, but you can still do everything if you go directly to a/b/c. % mkdir -p a/b/c % chmod 711 a/b % sudo chown root a/b % ll a/b ls: cannot open directory a/b: Permission denied % touch a/b/c/this.txt % ls a/b/c this.txt Beware that ...


27

Execute as root: # swapoff -a And to make that change permanent, edit /etc/fstab and remove or comment-out the swap entry.


26

That library has a main() function or equivalent entry point, and was compiled in such a way that it is useful both as an executable and as a shared object. Here's one suggestion about how to do this, although it does not work for me. Here's another in an answer to a similar question on S.O, which I'll shamelessly plagiarize, tweak, and add a bit of ...


24

I'll answer your questions out of order: the release team chooses code names; the next two releases are Stretch and Buster; and I don't think we're worried about running out of names yet... As pointed out by eyoung100, Strech is the octopus in Toy Story 3, and Buster is Andy's dog. Also, Sid is the name of the next-door kid who breaks all his toys. "Still ...


22

This can easily be done using ImageMagick identify -format '%n %i\n' -- *.gif 12 animated.gif 1 non_animated.gif identify -format %n prints the number of frames in the gif; for animated gifs, this number is bigger than 1. (ImageMagick is probably readily available in your distro's repositories for an easy install)


16

The "Everything is a file" phrase defines the architecture of the operating system. It means that everything in the system from processes, files, directories, sockets, pipes, ... is represented by a file descriptor abstracted over the virtual filesystem layer in the kernel. The virtual filesytem is an interface provided by the kernel. Hence the phrase was ...


15

Let's dive for an answer in random glibc repo in github. This version provides a „banner“ at file version.c: https://github.com/lattera/glibc/blob/a2f34833b1042d5d8eeb263b4cf4caaea138c4ad/csu/version.c In same file there is a few interesting points: __libc_print_version the function that provides printing to stdin same text and symbol __libc_main (void) ...


13

You already have a good answer for most of it. But for intrest I thought I would play into the math of running out of names: It has been 19 years since the first codenamed release (Buzz 1996). so far 13 character names are used. Toy Story has 40ish potential names, assuming no more movie. If we assume that names continue being used at the same rate. I ...


11

Comment/remove the relevant entry in the /etc/fstab to prevent it from being reenabled on the next boot, then reboot or run swapoff -a to disable the usage of the swap partition for the currently running system. Now delete the swap partition, extend your system partition over that unused space and extend the actual filesystem. I don't know whether your ...


8

Since @William still got it wrong (!) here we go: The format of lines in /etc/hosts is address first and name(s) second 0.0.0.0 node1 0.0.0.0 node2 192.168.1.1 myroutermaybe 8.8.8.8 googledns # in case DNS doesn't work for DNS??? 127.0.0.1 localhost or where several names map to the same address 0.0.0.0 node1 node2 node3 stitch626


8

With those permissions, you can't reach your goal. In order to get to directory c, you must allow all other users to traverse directory b which is done by giving execute permission for that directory. With /a/b set to mode 711, you can achieve what you want since you are granting directory traversal but denying read and write. But do keep in mind that while ...


8

Using exiftool: exiftool -q -if '$framecount > 1' -p '$directory/$filename' -r -ext:gif . Would report the paths of the GIF files that have more than one frame (in the current directory, recursively).


7

No stdout/stdin there at the PAM stage. You need to call pam_conv(3) via pam_get_item(3) to perform i/o. Good example at ben.akrin.com including the relevant C source example. pam_conv(3) pam_get_item(3)


7

Clearing the swap is not necessary nor useful. Read linuxatemyram. The kernel has a quite efficient page cache. So RAM is used for useful data (e.g. recently accessed file segment chunks, or heap memory), and less useful data got swapped to the swap zone. Perhaps your swap zone might be too small. You could also swap to some file. See this.


7

use ls -l -d /tmp/ and you will see that the permissions are set to drwxrwxrwt, i.e. d: a directory, rwx: read, write and execute permissions allowed for owner, group and others (in this order), t sticky bit, i.e. only file owners are allowed to delete files (not the group despite permissions). Let's leave the sticky bit aside for the moment and mention that ...


7

You can do { while read l<&3; do { head -c"$l" echo } 3<&- done 3<lengths.txt } <String.txt It requires some explanation: The main idea is to use { head ; } <file and is derived from the underestimated @mikeserv answer. However in this case we need to use many heads, so while loop is introduced and a little ...


7

Generally, you don't want to use shell loops to process text. Here, I'd use perl: $ perl -lpe 'read STDIN,$_,$_; print ">Entry_" . ++$n' lengths.txt < string.txt >Entry_1 abcde >Entry_2 fghi >Entry_3 jklmnopqrs >Entry_4 tuvwxyz That's one command, that reads (with buffering so a lot more efficiently than the shell's read command that ...


7

By default, watch runs your command with /bin/sh -c '...' so the output you see is how /bin/sh interprets the time command. Your /bin/sh apparently doesn't have a builtin time. To run the command with a different shell, use the -x option to get rid of the default, then add your own explicit invocation of the shell whose builtin you want. watch -x bash -c ...


6

Bug in the implementation of ext4 feature dir_index which you are using on your destination filesystem. Solution : recreate filesytem without dir_index. Or disable feature using tune2fs (some caution required, see related link Novell SuSE 10/11: Disable H-Tree Indexing on an ext3 Filesystem which although relates to ext3 may need similar caution. (get a ...


6

You could use bindfs like: $ ls -ld dir drwxr-xr-t 2 stephane stephane 4096 Aug 12 12:28 dir/ That directory is owned by stephane, with group stephane (stephane being its only member). Also note the t that prevents users from renaming or removing entries that they don't own. $ sudo bindfs -u root -p u=rwD,g=r,dg=rwx,o=rD dir dir We bindfs dir over ...


6

bash, version 4 mapfile -t lengths <lengths.txt string=$(< String.txt) i=0 n=0 for len in "${lengths[@]}"; do echo ">Entry_$((++n))" echo "${string:i:len}" ((i+=len)) done output >Entry_1 abcde >Entry_2 fghi >Entry_3 jklmnopqrs >Entry_4 tuvwxyz


6

GParted -> Swapoff, not closing it swapoff -a as root to make sure the swap is off cat /proc/swaps to make 100% sure the swap is off Commenting out the swap's UUID in /etc/fstab as root Removing the file /etc/initramfs-tools/conf.d/resume, which contained the UUID, as root Deleting the swap partition using GParted and applying the change. Not allocating the ...


6

Neither bash nor ksh can perform floating point arithmetic (ksh93 supports that if I remember correctly). I recommend to switch to zsh or run external tool like bc: $ CPU_IDLE=98.67 $ echo "$CPU_IDLE" $ CPU_USAGE=$( bc <<< "100 - $CPU_IDLE" ) $ echo "$CPU_USAGE" 1.33


6

There is no original GNU/Linux operating system. Linux is the kernel and GNU is the operating system. A Linux distribution is created when users combine the Linux kernel with the essential tools that run an operating system. Some History in a Nutshell GNU set out to make a free UNIX-like operating system in 1983. By the early 1990's, GNU had all of the ...


6

The /sys directory is generally where the sysfs filestystem is mounted, which contains information about devices and other kernel information. The files in /sys/block contain information about block devices on your system. Your local system has a block device named sda, so /sys/block/sda exists. Your Amazon instance has a device named xvda, so ...


5

While accessing it by /dev/sdXy is risky, a more accurate identification may be done by UUID. Since you mention (at some point) changing the usb stick, to maintain compatibility, you may want to identify your usb stick by a label. To do so, you can: /dev/disk/by-label/YourLabelHere. Note that you need to set the label to a new usb stick before running the ...


5

RFC 1122 specifies in section 4.2.3.6 that the keep-alive period must not default to less than two hours.


5

4GB of memory requires 32 bits to store addresses. Most 32-bit processor architectures can only address 4GB of memory, and older x86 CPUs are no exception. More recent 32-bit x86 CPUs can access more than 4GB of physical memory through a processor feature called PAE.¹ 64-bit x86 CPUs always have PAE. PAE requires a Linux kernel compilation option. Without ...


5

How can I see the raw memory data used by an application... Once you have obtained the process' PID (using ps(1) or pidof(8) for instance), you may access the data in its virtual address space using /proc/PID/maps and /proc/PID/mem. Gilles wrote a very detailled answer about that here. ... and all the files its accessing in my filesystem, network ...


5

I don't think that there is a concept of "directory created by system". When you're installing your system, installation media often gets job done for you - you see the result(e.g. /etc directory created), but that really is done by user who happened to run script. Anything created by "system" could be treated as created by root, but there's no way of ...



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