Hot answers tagged

17

There are three independent "directories" at play here: your current shell's current working directory, the shell script's current working directory, and the directory containing the shell script. To demonstrate that they are independent, you can write a shell script, saved to /tmp/pwd.sh, containing: #!/bin/sh pwd cd /var pwd You can then change ...


4

MemAvailable is included in /proc/meminfo since version 3.14 of the kernel; it was added by commit 34e431b0a. That's the determining factor in the output variations you show. The commit message indicates how to estimate available memory without MemAvailable: Currently, the amount of memory that is available for a new workload, without pushing the system ...


4

Yes, it is provided by GRUB. The GRUB command shell is just as powerful as the shell. You can use it to discover boot images, kernels, and root filesystems. When you're at the grub> prompt, you have a lot of functionality similar to any command shell such as history and tab-completion. The grub rescue> mode is more limited, with no history and no ...


4

You could add word boundaries, and change . to \. (so as to match literal periods, instead of any characters) sed 's/\b72\.16\.90\.12\b/#&/g' Also note the use of & to save having to duplicate the replacement. You probably don't need the g modifier either in this context, since your host addresses are one per line.


4

Present (or Current) Working Directory Does the command pwd in a shell script return the directory the shell script is in? No. Firstly, by definition, no shell script or shell command returns anything other than a numeric exit status between 0 - 255. That's axiomatic, but not generally not what people mean when they ask these types of questions. ...


4

The most important parts are the GCC compiler, glibc C library, the coreutils and binutils basic Unix tools, and probably the bash shell and the Gnome desktop environment (if you use those). Just source line count doesn't take the relative importance into account. If you take e.g. Debian's or Fedora's full software selection, most people don't even install ...


3

I did this exact thing, and it is quite easy. I followed the guide for Arch and it works as described. You should follow the instructions for your own distribution of they are provided. Just a few caveats to keep in mind: lowest common denominator hardware: if you want it to run in both 32 and 64 bit computers, install the 32 bit version. same goes for ...


3

There is this concept called cwd that every running process keeps track of. Or better worded: the kernel keeps an idea of the cwd of each process. That could be read with (for a system with /proc): readlink /proc/$PID_of_PROCESS/cwd And for the running shell (of which its PID should be $$): $ readlink /proc/$$/cwd The shell keeps track of the same ...


3

You could have a partition on two disks if you used Brtfs file system or LVM, but creating a partition on two disks will be similar in performance to moving /home to a spinning HDD. In your case you should probably take a look at dm-cache


3

In Linux, /dev/random gives high quality random bits. They are derived from sources that are not predictable and not repeatable, external to the machine. In contrast, /dev/urandom uses the same random data as /dev/random (if available), if there is none, it uses a pseudo-random number generator, which is deterministic. For most purposes, it is unpredictable ...


3

If you have faketime and your date is dynamically linked: faketime -f -10m date -d 'last monday' '+%F %T' With ksh93 (only builtin commands): printf '%(%F %T)T\n' "$(printf '%(%Y.%m.%d)T' '10 minutes ago')-0 last monday" Here, if it was last Sunday instead of last Monday, you could do: date -d "$(date -d '10 minutes ago' +"%F -%u day")" Or if it was ...


2

If you need in depth scheduling info, you could use one of these tools - perf SystemTap dtrace (I dont know what the state of the linux port is) sysdig All of these can tap into kernel hooks to display events such as context switches, interrupts, I/O, system calls etc.


2

For the first question see Wikipedia here you have the minimum requirements. Second question, just a google search. Third question from Linux.org. Fourth, For me is Ubuntu, but depends of what I want to do. I recommend you, if you will use Gnu/Linux system, to use Google, I found all your answers in just 5 minutes of search. Gnu/Linux systems are google ...


2

Set the default route to the next hop on eth2 and a separate route for 111.222.111.222. Let's assume that 1.2.3.4 is the next hop for eth1 then the command would be: ip route add 111.222.111.222/32 via 1.2.3.4


2

I was able to boot to USB on XServe G4. I was using the "memstick" bootable image I obtained from FreeBSD ftp://ftp.freebsd.org/pub/FreeBSD/releases/powerpc/powerpc/ISO-IMAGES/10.2/ I inserted my USB stick into the first usb port (in OF, it is known as "usb0") Note, this has to be done directly for some reason; you can't insert the USB stick into a hub. ...


2

ext4 should be resilient against even pulling the plug. However, in order to be so, it requires the storage subsystem to not lose committed writes. First, confirm that you're not mounting with barrier=0/nobarrier. That often improves performance, at the cost of corruption if a proper shutdown isn't performed. Also check your kernel logs to make sure ...


2

You are only able to mount partitions with known filesystems on it (Yes that information is on the disk). For getting info about supported filesystem-types, try man mount If you want to give the automation a try, use (as root) : mkdir /mnt mount /dev/<your-partition> /mnt and observe the output. Probably you just forgot to specify the ...


2

You are missing one pipe | character. Try: sort myfile |uniq -u|tee newfile.txt If this is not working, please provide the error message you are getting. By the way, this command uniq -u eliminates all lines which have duplicates. If this is your intention, that is fine. But if you want to see one of the duplicate lines, you need to drop -u for the uniq ...


2

In addition to vonbrand's answer, let's not forget a major contribution to the GNU/Linux OS is that a lot of the GNU stuff was already there, already functional as a whole ecosystem and freely available under an open source license when the Linux (kernel) project started. One should not forget either what the original GNU project goal was, i.e. building a ...


2

My guess is that you don't have the correct dynamic linker on the Busybox system. On your Arch system do this: ldd ./simplestprogram I imagine ldd will give you output similar to this: linux-vdso.so.1 => (0x00007fff9b34f000) libc.so.6 => /lib64/libc.so.6 (0x0000003b19e00000 /lib64/ld-linux-x86-64.so.2 (0x0000003b19a00000) That last line, ...


2

You need to build or install a uClibc toolchain and compile/link your programs with that. You do not compile them with the standard gcc/make/.... Do I really need to build a uClibc toolchain?


1

ssh remote_host "sed -i -e 's/12.1.0.11/#12.1.0.11/g' -e 's/12.1.0.12/#12.1.0.12/g' -e 's/12.1.0.21/#12.1.0.21/g' -e's/12.1.0.22/#12.1.0.22/g' /etc/hosts" I'm pretty sure you can wildcard these values but dealing with regex over remote connections is not my idea of fun as it may require a lot of escape characters and gets out of hand quickly


1

The 98.2%id means that most of the time, CPU does nothing (The CPU is in idle state). To determine how is used the CPU over time, you can use uptime command that will gives you the load average.


1

Recommend eliminating all blanks in makefile conditionals. See this makefile, which works perfectly. TXT="--" ifeq ($(LON_GEMINI_BOX),1) TXT="works!" EXTRA_CFLAGS += EXTRA_CFLAGS += else TXT="why is this happening" endif all: @echo $(TXT)


1

You can attach to the session from "another terminal" (including another ssh connection). That lets you recover anything that was in progress. You can always kill the screen session as you started it, by using sudo to kill the parent process of the screen session (the one named "screen"). The feature only is useful if it is properly configured to begin ...


1

You have three possibilities here. Since you don't want to compile from source there are two remains: CentOS packages should work for rhel. At least it always worked for my rhel6.6. So you can download desired rpm from centos repo to your ubuntu then copy to rhel and install Using ubuntu's package manager download .deb package and then convert deb->rpm ...


1

It is normally impossible to cause files in a directory to be owned by a particular user (unless that user was writing the files in the first place). The reason is that (under most Unix variants, including Linux) it's forbidden to give away files. However you can achieve this effect by using a filesystem that presents a different ownership of files. One ...


1

The Depends on section in menuconfig is stored in Kconfig files' depends on sections. config CRYPTO_FIPS bool "FIPS 200 compliance" depends on (CRYPTO_ANSI_CPRNG || CRYPTO_DRBG) && !CRYPTO_MANAGER_DISABLE_TESTS depends on MODULE_SIG help This options enables the fips boot option which is ...


1

If you're using the ncurses based configuration (make menuconfig) just search your particular kernel option (press / then type CONFIG_CRYPTO_FIPS) and it's dependencies will also be listed in there. For instance in my 3.13 kernel tree I get: Symbol: CRYPTO_FIPS [=n] ...



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