Tag Info

Hot answers tagged

55

I ran this: strace -o spork.out bash -c "echo 1234 >> some-file" to figure out your question. This is what I found: open("some-file", O_WRONLY|O_CREAT|O_APPEND, 0666) = 3 No file named "some-file" existed in the directory in which I ran the echo command.


53

I'll answer your questions in three parts: file types, permissions, and use cases for the various forms of chmod. File types The first character in ls -l output represents the file type; d means it's a directory. It can't be set or unset, it depends on how the file was created. You can find the complete list of file types in the ls documentation; those ...


46

This is all due to the fact that the X server is out-dated, ill-suitable for today's graphics hardware and basically all the direct video card communication is done as an extension ("patch") over the ancient bloated core. The X server provides no builtin means of synchronization between user rendering the window and the screen displaying a window, so the ...


45

This is not only done in Bash, it's required by the standard. From the Single Unix Specification: Appended output redirection shall cause the file whose name results from the expansion of word to be opened for output on the designated file descriptor. The file is opened as if the open() function as defined in the System Interfaces volume of POSIX.1-2008 ...


35

And now, the systemd answer. You're using, per the tag on your question, Red Hat Enterprise Linux. Since version 7, that has used systemd. None of the other answers are correct for the world of systemd; nor even are some of the assumptions in your question. Forget about runlevels; they exist, but only as compatibility shims. The systemd documentation ...


34

System 5 init will tell you only a small part of the story. There's a sort of myopia that affects the Linux world. People think that they use a thing called "System 5 init", and that is both what is traditional and the best place to start. Neither is in fact the case. Tradition isn't in fact what such people say it to be, for starters. System 5 init and ...


33

You should use the at command: $ sudo at 6:45 [sudo] password for root: warning: commands will be executed using /bin/sh at> poweroff at> <EOT> Don't type the <EOT>, but press Ctrl+D at the second at> prompt. The significant advantage of using at over using shutdown with a TIME argument, is that it involves real, persistent, ...


29

Here are the commands you need to run, if you just want to get it done: sudo add-apt-repository ppa:git-core/ppa -y sudo apt-get update sudo apt-get install git git --version As of Dec 2014, I get git 2.2.0 that way, while the version in the Ubuntu Trusty repositories is 1.9.1. Note that add-apt-repository is installed via: sudo apt-get install ...


29

Yes! This is a big deal, and incredibly common. And there are two basic approaches. One way is simply with scripted installs, as for example used in Fedora, RHEL, or CentOS's kickstart. Check this out in the Fedora install guide: Kickstart Installations. For your simple case, this may be sufficient. (Take this as an example; there are similar systems for ...


28

In a word: binfmt_misc. It's a Linux-specific, non-portable, facility. There are a couple of formats that are recognized by the kernel with built-in logic. Namely, these are the ELF format (for normal binaries) and the shebang convention (for scripts). (thanks to zwol for the following part of the answer). In addition, Linux recognizes a couple of esoteric ...


27

Looking in the source, it does use O_APPEND. For bash 4.3.30 in make_cmd.c line 710-713 read: case r_appending_to: /* >>foo */ case r_append_err_and_out: /* &>> filename */ temp->flags = O_APPEND | O_WRONLY | O_CREAT; break;


26

A new install will seldom break your system (unless you do weird stuff like mixing source and binary). If you use precompiled binaries in Ubuntu then you can remove them and not have to worry about breaking your system, because a binary should list what it requires to run and your package manager will list what programs rely on that program for you to ...


25

No matter the fancy name used here, both are solutions to a specific problem: A better segregation solution than classic Unix chroot. Operating system-level virtualization, containers, zones, or even "chroot with steroids" are names or commercial titles that define the same concept of userspace separation, but with different features. Chroot was introduced ...


25

You can use the echo or find commands instead of ls: echo * or: find -printf "%M\t%u\t%g\t%p\n"


23

You can also use the printf command, instead of echo: printf '%s\n' * printf is superior to echo in this situation in that echo does not respect the "double dash" (--) to signify the end of the argument list (on some systems, including Ubuntu 14.04 which is what I tested it on): llama@llama:~$ mkdir -p Misc/unix210948 llama@llama:~$ cd !$ cd ...


22

Yes, you can do this by accessing the master key while the volume is decrypted. The quick and dirty to add a new passphrase: device=/dev/sda5 volume_name=foo cryptsetup luksAddKey $device --master-key-file <(dmsetup table --showkeys $volume_name | awk '{ print $5 }' | xxd -r -p) device and volume_name should be set appropriately. volume_name is the ...


22

SCSI is not only a type of hardware interface, but also a command protocol, which is used for abstraction of most of the modern storage devices. Linux scsi driver is a high level driver that handles a variety of storage hardware. Protocol: http://en.wikipedia.org/wiki/SCSI_command Extract from SCSI on wikipedia: Other technologies which use the SCSI ...


20

The 1 GiB limit for Linux kernel memory in a 32-bit system is a consequence of 32-bit addressing, and it's a pretty stiff limit. It's not impossible to change, but it's there for a very good reason; changing it has consequences. Let's take the wayback machine to the early 1990s, when Linux was being created. Back in those days, we'd have arguments about ...


20

I checked uname manual (man uname) and it says the following for the "-a" option: print all information, in the following order, except omit -p and -i if unknown In Ubuntu, I guess, options "-m", "-p" and "-i" (machine, processor and hardware-platform) are returning the machine architecture. For example, if you use the command uname -mpi You will ...


19

Yes and no. *nix has a huge advantage over Windows in package management. Unlike in Windows where you must rely on third-party packages to have sane (un)installers, *nix distributions offer package managers that take care of installation and uninstallation in a unified manner. As a result, when you remove a package, all the system-level files for that ...


19

You can use shutdown: sudo shutdown -h 06:45 & And to check it: ps -aux | grep shutdown If you want to cancel it: sudo shutdown -c This assumes of course that the shutdown time has already passed.


18

Answer to my question, from Qualys: During our testing, we developed a proof-of-concept in which we send a specially created e-mail to a mail server and can get a remote shell to the Linux machine. This bypasses all existing protections (like ASLR, PIE and NX) on both 32-bit and 64-bit systems. My compiled research below for anyone else ...


18

You can do it with single command with sed 's/\(.*\)-/\1 /' The point is that sed is very greedy, so matches as many characters before - as possible, including other -. $ echo 'swp-RedHat-Linux-OS-5.5.0.0-03' | sed 's/\(.*\)-/\1 /' swp-RedHat-Linux-OS-5.5.0.0 03


18

fork() was the original UNIX system call. It can only be used to create new processes, not threads. Also, it is portable. In Linux, clone() is a new, versatile system call which can be used to create a new thread of execution. Depending on the options passed, the new thread of execution can adhere to the semantics of a UNIX process, a POSIX thread, ...


17

You can write to /dev/random because it is part of the way to provide extra random bytes to /dev/random, but it is not sufficient, you also have to notify the system that there is additional entropy via an ioctl() call. I needed the same functionality for testing my smartcard setup program, as I did not want to wait for my mouse/keyboard to generate enough ...


17

It is because of NPTL. Since it is part of the GNU C library nearly every modern linux distribution don't uses the first two real time signals anymore. NPTL is an implementation of the POSIX Threads. NPTL makes internal use of the first two real-time signals. This part of the signal manpage is very interesting: The Linux kernel supports a range of 32 ...


17

change the age of password to 0 day syntax chage -d 0 {user-name} In this case chage -d0 foo This works for me over ssh also


17

halt instructs the hardware to stop all CPU functions, but leaves it in a powered-on state. This usually means someone has to reboot or shut the machine down manually by pressing the power button afterwards. The specific way to achieve this is architecture specific, but for instance the x86 instruction set provides the HLT instructions which halts the ...


17

Let's investigate that using strace on a local (non-NFS) filesystem: $ strace -eopen -- bash -c "echo foo >> /tmp/testfile000" 2>&1 | grep /tmp/testfile000 open("/tmp/testfile000", O_WRONLY|O_CREAT|O_APPEND, 0666) = 3 $ strace -eopen -- bash -c "echo foo > /tmp/testfile000" 2>&1 | grep /tmp/testfile000 open("/tmp/testfile000", ...


16

The short answer is no. The driver support for the same kernel version is configurable at compile time and also allows for module loading. The actual devices supported in a distro therefore depend on the included compiled in device drivers, compiled loadable modules for devices and actual installed modules. There are also devices not included in the ...



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