date
int64
1,220B
1,719B
question_description
stringlengths
28
29.9k
accepted_answer
stringlengths
12
26.4k
question_title
stringlengths
14
159
1,554,251,819,000
I'm trying to determine which process is using a large number of Huge Pages, but I can't find a simple Linux command (like top) to view the Huge Page usage. The best I could find was $ cat /sys/devices/system/node/node*/meminfo | fgrep Huge Node 0 HugePages_Total: 512 Node 0 HugePages_Free: 159 Node 0 HugePages_...
I found a discussion on ServerFault that discusses this. Basically, $ sudo grep huge /proc/*/numa_maps /proc/4131/numa_maps:80000000 default file=/anon_hugepage\040(deleted) huge anon=4 dirty=4 N0=3 N1=1 /proc/4131/numa_maps:581a00000 default file=/anon_hugepage\040(deleted) huge anon=258 dirty=258 N0=150 N1=108 /proc...
How to monitor use of Huge Pages per process
1,554,251,819,000
How does a Linux instance determine its IP address? That is, not the 127.0.0.1. Is this stored in file or does ifconfig somehow calculate it at every invocation? I managed to solve it just to show I made an effort, but it is not anything I'd put in a serious application: sudo ifconfig | head -n 2 | tail -n 1 | tr -s "...
The information can change at any time, so it needs to be retrieved from the kernel, it can't be stored in a file. There is no really nice way to obtain this information. Your parsing is as good as any, except that hard-coding the second line is wrong: there is no guarantee that the interfaces will be listed in any pa...
IP of localhost
1,554,251,819,000
I understand that Spinlocks are real waste in Linux Kernel Design. I would like to know why is it like spin locks are good choices in Linux Kernel Design instead of something more common in userland code, such as semaphore or mutex?
The choice between a spinlock and another construct which causes the caller to block and relinquish control of a cpu is to a large extent governed by the time it takes to perform a context switch (save registers/state in the locking thread and restore registers/state in another thread). The time it takes and also the ...
Why are spin locks good choices in Linux Kernel Design instead of something more common in userland code, such as semaphore or mutex?
1,554,251,819,000
I'm trying to override malloc/free functions for the program, that requires setuid/setgid permissions. I use the LD_PRELOAD variable for this purpose. According to the ld documentation, I need to put my library into one of the standard search directories (I chose /usr/lib) and give it setuid/setgid permissions. I've d...
According to the ld documentation, I need to put my library into one of the standard search directories (I chose /usr/lib) That was the mistake. You should've put it in /usr/lib64 (assuming that your machine is a x86_64). I've just tried the recipe from the manpage on a Centos 7 VM (which should be ~identical to RHE...
LD_PRELOAD for setuid binary
1,554,251,819,000
I'm looking for some interfaces to monitor the use of the CPU and the temperature, i have already installed lm-sensors for temp and htop for CPU but i want something that shows them always in real-time in the bar at the top of the screen (the one which says time, battery% ecc.. sorry i don't know how it is called) so ...
The software is called psensor. Linux: https://wpitchoune.net/psensor/ Specific for Ubuntu: https://wpitchoune.net/psensor/ubuntu.html There is an option to display the info on the toolbar, as well as in a stand-alone window.
Monitoring CPU and temperature
1,554,251,819,000
I have a problem, like I need to find the directories that got updated yesterday. I tried using find command but its listing all the files that got updated in the directories. But I need only the directory names.
You can use -type d in the find string: find /path/to/target -type d -mtime 1
How to find Directories that updated last day in linux?
1,554,251,819,000
sudo -EH -u someuser nohup sh check.sh & Above commands runs the process as root instead of the user specified by -u flag. root 4056 2388 0 13:00 pts/4 00:00:00 sudo -EH -u someuser nohup sh /tmp/check.sh & Below are the sudoers entry. Cmnd_Alias SUDO_CMNDS = /bin/echo,/bin/ls,/bin/cat,/bin/vim,/bin/mv,/bi...
This line: root 4056 2388 0 13:00 pts/4 00:00:00 sudo -EH -u someuser nohup sh /tmp/check.sh is reporting that sudo ... was run as the root user. That happens because the sudo binary is setuid, and it's expected (regardless of which user asked sudo to run). What you're trying to find out is what user the command that...
Sudo command gets executed as root instead of specified user
1,554,251,819,000
There is a command in Microsoft's cmd, called color. I know that, in bash, there are special characters that allows you, during the echos, to change the text colors. As well I do know that in ubuntu you can edit the parameters of the terminal setting a "style" going inside the config, editing it and applying it with ...
There are multiple ways you can do this. One way is by using tput: tput setab 4 sets the background color to blue. To set the foreground color, use tput setaf. Another way is by using raw ANSI escapes, here is a good documentation: https://misc.flogisoft.com/bash/tip_colors_and_formatting
Does bash have a color command, as seen in MS-Windows CMD? [duplicate]
1,554,251,819,000
I'm trying to make a script that will unzip a password protected file, the password being the name of the file that I will get when unzipping Eg. file1.zip contains file2.zip and its password is file2. file2.zip contains file3.zip and its password is file3 How do I unzip file1.zip, and read the name of file2.zip so ...
If you don't have and cannot install zipinfo for any reason, you can imitate it by using unzip with -Z option. To list the contents of the zip use unzip -Z1: pw="$(unzip -Z1 file1.zip | cut -f1 -d'.')" unzip -P "$pw" file1.zip Put it to a loop: zipfile="file1.zip" while unzip -Z1 "$zipfile" | head -n1 | grep "\.zip$...
Bash loop unzip passworded file script
1,554,251,819,000
From what I had read sometime back, it seems iwconfig is deprecated and the current methods is - $ sudo ifconfig wlan0 up and $ sudo ifconfig wlan0 down But couldn't find anything which tells the status of the wifi and know which mode it is on, which AP it is attached to, how much data is being transferred and so o...
The current (in 2017) methods are: ip for all network interfaces, including setting up and down: ip link set wlan0 up ip link set wlan0 down ip help ip link help ip addr help iw for wireless extensions (needs to be called as root): iw dev iw phy iw wlan0 scan iw wlan0 station dump iw help ifconfig and iwconfig are...
How to find status of wlan0?
1,554,251,819,000
I'm really trying to understand why our guest VMs aren't using the kvm-clock driver "like they're supposed to". They're running RHEL 7.2, glibc-2.17, kern 3.10.0. Programs such as date and perl -e 'print time' get the current time, but do so without making a system call. This is confirmed with strace and ltrace and f...
I think the reason you don't see a syscall happening, is that some Linux system calls (esp. those related to time, like gettimeofday(2) and time(2)) have special implementations through the vDSO, which contains somewhat optimized implementations of some syscalls: The "vDSO" (virtual dynamic shared object) is a small ...
Why don't Linux utils use a system call to get the current time?
1,554,251,819,000
I am trying to copy files from machineB and machineC into machineA as I am running my below shell script on machineA. If the files is not there in machineB then it should be there in machineC for sure so I will try copying the files from machineB first, if it is not there in machineB then I will try copying the same f...
The obvious is: parallel -j 2 do_CopyInPrimary ::: "${PRIMARY_PARTITION[@]}" & parallel -j 2 do_CopyInSecondary ::: "${SECONDARY_PARTITION[@]}" & wait But this way the secondary does not wait for the primary to finish and it does not check if the primary was successful. Let us assume that $PRIMARY_PARTITION[1] corres...
How to launch two threads in bash shell script?
1,554,251,819,000
Possible Duplicate: Linux tools to treat files as sets and perform set operations on them I have two data sets, A and B. The format for each data set is one number per line. For instance, 12345 23456 67891 2345900 12345 Some of the data in A are not included in data set B. How to list all of these data in A, and...
Use the comm command. If you lists are in files listA and listB: comm listA listB By default, comm will return 3 columns. Items only in listA, items only in listB, and items common to both lists. You can suppress individual columns, with a -1, -2, or -3 arg.
list the difference and overlap between two plain data set [duplicate]
1,554,251,819,000
Windows has a "Resilient FileSystem" since Windows 8. Are there similarly resilient filesystems for Linux? What I expect from such a filesystem is that a bad block won't screw up either files or the journal. I'm no FS geek, so please explain if such error-resilience is unfit for a desktop/CPU intensive/memory intensiv...
If you're looking for advanced filesystems for general-purpose computers in the Linux world, there are two candidates: ZFS and BTRFS. ZFS is older and more mature, but it's originally from Solaris and the port to Linux isn't seamless. BTRFS is still under heavy development, and not all features are ready for prime tim...
Are there error resilient filesystems for Linux?
1,554,251,819,000
As far as I understand, the traditional place for home directories is beneath /home. Some Linux variants seem to keep them in /var/home, what's the reason for that?
My guess is that WebOS is designed to be installed on two different filesystems, a root filesystem that is read-only in normal operation and a filesystem mounted on /var that is read-write in normal operation. Since home directories need to be writable, they are placed somewhere under /var. This kind of setup is fairl...
Why would I keep home directories in /var/home?
1,554,251,819,000
How do I use GNU touch to update a file called -? How do I use GNU cat to display a file called -? I'm running: % cat --version | head -n1 cat (GNU coreutils) 8.29 % touch --version | head -n1 touch (GNU coreutils) 8.29 Firstly, touch: % touch - % ls -l total 0 % touch -- - % ls -l -- - ls: cannot access '-': No su...
Use an explicit path to the file: touch ./- cat ./- GNU touch treats a file operand of - specially: A FILE argument string of - is handled specially and causes touch to change the times of the file associated with standard output. For cat, the POSIX standard specifies that a file operand - should be interp...
How to `touch` and `cat` file named `-` [duplicate]
1,554,251,819,000
I am trying to run VMware on kali linux but when I try to run it show message that Before you can run VMware several modules must be compiled and loaded into the running kernel Here is log: 2018-04-23T20:11:48.254+04:30| vthread-1| I125: Log for VMware Workstation pid=8508 version=14.1.0 build=build-7370693 option=Rel...
Issue At Hand You are reporting that you are unable to run VMware on Kali Linux. According to the errors you have posted your Operating System is missing the VMware modules necessary to run. I will take this time to point out that Kali Linux is not meant as a general purpose Operating System. You may continue to run ...
Before you can run VMware several modules must be compiled
1,554,251,819,000
lets say we want that only user tutu can read the file /home/grafh/file.txt what is the configuration that need to do in order to enable that? file owner must be stay as root ( and only user tutu can read the file )
You have two possibilities, using the the classical DAC (Discretionary Access Control, the usual rwx rights) of using files ACL (Access Control Lists). Using DAC permissions If tutu has not its own group (check groups tutu output), you must create a new group and make tutu the only member of this group. root@host:~# a...
Linux + how to give only specific user to read the file
1,554,251,819,000
I'm learning to use dd by experimentally playing with its arguments. I would like to create a 10-byte file. I thought the following would work: dd if=/dev/zero of=./foo count=1 bs=1 obs=9 seek=1 ...because of these comments from the man page: obs=BYTES write BYTES bytes at a time (default: 512) seek=...
Your command dd if=/dev/zero of=./foo count=1 bs=1 obs=9 seek=1 creates a two-byte file rather than a 10-byte file because of poorly-defined interaction between bs and obs. (Call this a program bug if you like, but it's probably better defined as a documentation bug.) You are supposed to use either bs or ibs and obs. ...
dd with obs and seek makes file of unexpected size
1,554,251,819,000
I'm using a Chromebook and would like to navigate inside the Android container via the shell. The container is mounted at the path /run/containers/android_XXXXX. When trying to cd into the directory, I'm told Permission Denied. I've tried running the command as sudo, but for some reason the cd command becomes inaccess...
The directory is drwx------ so only someone whose uid is 655350 (which is not listed in the password file) can read it or enter it. sudo cd not being able to find the cd command is expected, it is a builtin to the shell. If it wasn't builtin then it wouldn't work. Say your current shell has a process ID of 54000, you ...
Permission Denied: cd into directory
1,554,251,819,000
I recently had some trouble with a wireless card, and an online forum suggested searching dmesg with grep firmware. That helped, I was able to find the problem immediately! However, the previous hour was spent looking at dmesg and I couldn't identify anything relevant due to the overwhelming quantity of information! H...
Something like this would be useful: dmesg | grep -iC 3 "what you are looking for" For example, if looking for your video card, you could try: dmesg | grep -iC 3 "video" Or: dmesg | grep -iC 3 "graphics" The C 3 flag will print 3 lines before and after the matched string, just to give you some context on what th...
How to know what to grep for in dmesg?
1,389,268,938,000
When I put a flash disk into a card reader and make an image with dd, I see the actual size of the disk, like 512483328 bytes in the following example: 1000944+0 records in 1000944+0 records out 512483328 bytes (512 MB) copied, 33.0091 s, 15.5 MB/s Is it possible to get the same number without actually copying the da...
Using sgdisk You can use sgdisk to print detailled information: sgdisk --print <device> […] Disk /dev/sdb: 15691776 sectors, 7.5 GiB Logical sector size: 512 bytes […] When you multiply the number of sectors with the sector size you get the exact byte count that should match the output of dd. Using /sys directly You...
How can I find the actual (dd) size of a flash disk?
1,389,268,938,000
I just tried burning both a Debian CD and a Debian DVD from their .iso files and I've got a weird behavior: the checksum of the CD is correct but the one of the DVD ain't. Here's what working: downloaded the two .iso files verified the checksum of the two .iso files burn the CD debian-7.1.0-amd64-CD-1.iso to a CD ve...
In addition to Gilles answer, If you still have the ISO image, you could use cmp instead of checksums. It would tell you at which byte the difference happens. It would also make the check faster as if there is an error early on, it would tell you right away, whereas the checksum always has to read the entire media. $ ...
How to take sha-1, sha-256 or MD5 of CDs / DVDs?
1,389,268,938,000
I'm using Ubuntu Lucid (10.04). In my shell script running as root I want to detect whether an audio cable (analog jack) is connected to the laptop or not. How do I do that? I don't need a portable solution, I need something, no matter how hacky, that works on my laptop.
One way could perhaps be to use amixer. Jack plugged in: $ amixer -c 0 contents numid=29,iface=CARD,name='Front Headphone Jack' ; type=BOOLEAN,access=r-------,values=1 : values=on ... Jack not plugged in: $ amixer -c 0 contents numid=29,iface=CARD,name='Front Headphone Jack' ; type=BOOLEAN,access=r-------,value...
How do I detect wheter the audio cable is connected?
1,389,268,938,000
I understand that /proc filesystem reflects the output of various processes. Unfortunately, I have a propietary (romdump) binary that expects the mount table to appear as /proc/mtd, while my Android device appears to output it as /proc/mounts. I've tried creating a symbolic link, but clearly this only works for actual...
The easiest way to do it would be to change the binary: sed s-/proc/mtd-/tmp/mntx- < romdump > romdump.new ln -s /proc/mounts /tmp/mntx ./romdump.new The trick here, since you're editing a binary, is to make sure the original string /proc/mtd is the same length as the new string /tmp/mntx, so that you don't change th...
Linking /proc/mnt to /proc/mounts
1,389,268,938,000
Without any DE or even X, I want to use ./my.exe to run mono my.exe, like it works with python scripts.
Bash has no such feature. Zsh does, you can set up aliases based on extensions: alias -s exe=mono This would only work in an interactive shell, however, not when a program invokes another. Under Linux, you can set up execution of foreign binaries through the binfmt_misc mechanism; see Rolf Bjarne Kvinge. Good Linux d...
How to set bash to run *.exe with mono?
1,389,268,938,000
I have been provided with a vendor supplied minimal linux installation. From an answer to a previous question I discovered that it is possible to build a kernel with or without module support. I have a CANBUS device that I need to attach which comes with drivers in the form of .ko files. I would like to be able to ins...
If you have a /proc filesystem, the file /proc/modules exists if and only if the kernel if compiled with module support. If the file exists but is empty, your kernel supports modules but none are loaded at the moment. If the file doesn't exist, your kernel cannot load any module. It's technically possible to have load...
Can I detect if my custom made kernel was built with module support?
1,389,268,938,000
Wikipedia entry for GNU gettext shows an example where the locale is just the lanuage, "fr". Whereas the 'i18n gettext() “hello world” example' in SO has the locale value with both the language and country, "es_MX". I have modified the "es_MX" example to use just the lanuage, "es". This covers making an "es" rather th...
From Zac Thompson's link to GNU gettext utilities section 2.3 Setting the Locale through Environment Variables the sub-section The LANGUAGE variable: In the LANGUAGE environment variable, but not in the other environment variables, ‘ll_CC’ combinations can be abbreviated as ‘ll’ to denote the language's main dialect....
Why does locale es_MX work but not es?
1,389,268,938,000
I'm working on an embedded ARM Linux system that boots using initramfs. (Here's some background from a couple earlier questions, if you're interested.) So far, thanks in part to help received here, I can boot the kernel via TFTP with an embedded initramfs. The MMC driver detects an SD card containing a new root filesy...
The reason that switch_root is not working on the command line is this code in busybox: if (st.st_dev == rootdev || getpid() != 1) { // Show usage, it says new root must be a mountpoint // and we must be PID 1 bb_show_usage(); } You are not PID 1, so you are falling through into this b...
Trouble getting busybox switch_root to work
1,389,268,938,000
Environment: OS: CentOS 8 (generic/centos8 Vagrant box) Virtualization: VMware-Workstation 16.1.0 build-17198959 Steps to reproduce: Create a devices new policy cd /sys/fs/cgroup/devices mkdir custom_poc Verify which device is being used as tty (multiple methods): Using tty: root@centos8# tty /dev/pts/0 Gett...
From the kernel doc: Implement a cgroup to track and enforce open and mknod restrictions on device files. The restrictions are only applied upon opening device files. That's the same as for most other access control permissions such as the standard Unix permissions. Once you have opened a file in read+write mode, y...
How can Bash still write to the terminal when blocking access to tty with cgroups?
1,389,268,938,000
When Xviewer or VLC are in full-screen mode on Linux Mint, my laptop does not go to sleep. Some other apps, e.g. mpv in full screen, do not prevent sleep. There is no options in Xviewer GUI on keep awake status. How does Xviewer do prevention and how to turn in off? How to turn-on sleep prevention for apps where I co...
Linux applications inhibit suspend through a D-Bus call to org.gnome.SessionManager.Inhibit Contrasting inhibit vs. prevent Note that inhibit is different than prevent. Inhibiting a screensaver, screen lock, or suspend only prevents the action from occurring when the computer is idle, not when it is manually activated...
Prevent system from going to sleep/suspend - how Xviewer/VLC do it
1,389,268,938,000
For certain obvious usages, the grep command can output multiple complaints about search names being directories. Note the multiple "Is a directory" warnings, this typically happens with commands like: grep text * eg: /etc/webmin # grep "log=1" * grep: cluster-webmin: Is a directory config:log=1 grep: cpan: Is a di...
Depending on the way you want to handle directories contents, grep -d recurse will do it (handling recursively directories), or grep -d skip (ignoring directories and their content). You could have this be automatic, by adding it to ~/.profile or ~/.bashrc (one user) or /etc/profile or /etc/bashrc (all users) alia...
suppress grep directory warnings globally
1,389,268,938,000
This tutorial says the following: For a directory, write permission allows a user to delete the directory, modify its contents (create, delete, and rename files in it), and modify the contents of files that the user can read. To test this, I created a directory named subdir that doesn't have the w permission bit...
It's wrong. To delete something you need write permissions on the directory containing it. That also goes for directories themselves: to delete a directory, you need (at a minimum) write permissions on the parent directory. You may need write permissions on the directory as well, but that's not enough by itself. Write...
Does the "w" permission bit on a directory allow you to delete the directory?
1,389,268,938,000
I’m looking for an open source software like Virtual-box that I can run on Linux but gives the possibility to program the BIOS (use a personal BIOS program). I want to understand (in a practical way) the process of computer boot up and have a deeper manipulation of the x86 real mode. I also want to understand the diff...
There are several virtual machine emulators that can emulate an x86 processor and peripherals. Each comes with a BIOS, several of them with an open-source BIOS. You should look at QEMU, which operates completely independently of the host (it can run on any machine, though it has mechanisms to run faster if the emulate...
Is there an open source software to simulate and virtually program a computer BIOS?
1,389,268,938,000
I have a Display that I want to write to. This is possible over the serial port. When I use a USB to RS-232 Converter, that thing works like a charm. I even tried using only the RX, TX and GND wires of the serial converter, and it still works. Now I want to use this Display in a small case paired with a Raspberry Pi, ...
I'm quite confident the problem is that the Pi does not have an RS232 interface, while the display has. The Pi has an (LV-)UART interface, its TX-pin outputs 0V for a logical 0 and 3.3V for a logical 1. This is quite easy to implement, since 3.3V is already available on the Pi. But this only works for communications ...
RaspberryPi serial port
1,389,268,938,000
Is there a way to work out how long it would take to reboot a Linux server? To clarify, the time from the reboot command starts to when the server is back up and running (ie all services started, users can log on etc). I tried looking at syslog but that seems to get rotated too quickly. To the nearest minute would suf...
I'm going to assume you're on CentOS 7+ or Ubuntu 15.04+ which both come with systemd. Systemd has some great tools for figuring out how long your system took to boot along with some visualizations to see why. For the most basic output just run systemd-analyze and you'll get a nice summary like so Startup finished in ...
Time it takes to reboot a Linux server
1,389,268,938,000
Given in Linux environment exists lot of packages for manipulating strings (grep, awk, sed, ...), I would like a software to extract a capturing group in a php/preg like syntax. Maybe the most close one is grep -P but I don't get how it works. Stuff like cat file.txt | grep -P '/something="([\w]+)"/i' seems not to giv...
pcregrep -io1 'something="(\w+)"' myfile.txt (-i for case insensitive matching, -o1 to print the first capture group). GNU grep supports a -P (if built with perl compatible regex support) and -o. However its -o is limited to printing the whole matched portions. You can however use perl look-around operators to work a...
How to extract under linux some capturing groups using command line in a php/preg fashion?
1,389,268,938,000
I was trying to fix my wifi on Kali Linux the other day and was following some tutorial. That didn't work, so I read somewhere that if I run this command iw dev wlan0 del After that command I can't seem to find my wlan device. When I type iwconfig it shows this: lo no wireless extensions. eth0 no wirele...
Easiest way is to just reboot. The type of configuration change you've made does not persist across reboots.
Accidentally deleted my wifi device wlan0
1,389,268,938,000
Does zswap compress pages, that are written to the swap device? Is it eligible to reduce swap IO?
At the LSFMM summit in 2013, there was no compression on pages written to the swap device. But it doesn't sound like there are any technical reasons why not, just that it would increase the complexity. Hugh [Dickins] added that compression of page cache (file) pages may be appealing, but the filesystem developers do...
Is zswap eligible to reduce swap IO?
1,389,268,938,000
In the below 2.6.18 Linux Kernel (Red Hat) server, there is a lot of free memory, but I see some swap is used. I always thought of swap as an overflow when memory has been depleted. Why would it swap with about 7GB (50%) free memory? Swappiness is 60 (default). Meminfo output: MemTotal: 16436132 kB MemFree: ...
Swapping only when there is no free memory is only the case if you set swappiness to 0. Otherwise, during idle time, the kernel will swap memory. In doing this the data is not removed from memory, but rather a copy is made in the swap partition. This means that, should the situation arise that memory is depleted, it d...
Why is swap used when a lot of memory is still free? [duplicate]
1,389,268,938,000
To get the vim user-manual I am doing vi test and then, once the file is opened, I do :help user-manual This opens up a split window, which makes reading manual inconvenient to read. How do I only open the user-manual in the full window ?
:h user-manual | only only : Make the current window the only one on the screen. All other windows are closed. See: :h only Open from terminal: vi[m] -c 'h user-manual|only'
How do I get just the user-manual for Vim
1,389,268,938,000
I have a certain Linux executable that is called from a bigger application to perform some calculations. I want to modify the way the calculations are performed, for that I first need to understand how the executable is called and in what way the parameters and data are transferred. So, I'd like to monitor the command...
Option 1 would be to modify the source code of the calling app and insert tee into the output pipeline to get a copy of the output for review at that stage. Option 2 would be to write a wrapper script around the executable in question. A quick script that passes on stdin and arguments to the real app, then tee's the o...
Intercept input and output from specific executable
1,389,268,938,000
I am dealing with an embedded system which has some memory that is accessible by a file descriptor (I have no idea what am I saying, so please correct me if I am wrong). This memory is 32 kB and I want to fill it with 0x00 to 0xFFFFFFFF. I know this for text files: exec {fh} >> ./eeprom; for i in {0..32767}; do echo $...
perl -e 'print pack "L*", 0..0x7fff' > file Would write them in the local system's endianness. Use: perl -e 'print pack "L>*", 0..0x7fff' perl -e 'print pack "L<*", 0..0x7fff' To force big-endian or little-endian respectively regardless of the native endianness of the local system. See perldoc -f pack for details. W...
How to write binary values into a file in Bash instead of ASCII values
1,389,268,938,000
I'm starting two child processes from bash script and waiting both for completion using wait command: ./proc1 & pid1=$! echo "started proc1: ${pid1}" ./proc2 & pid2=$! echo "started proc2: ${pid2}" echo -n "working..." wait $pid1 $pid2 echo " done" This script is working fine in normal case: it's waiting both proce...
Set-up a trap handling SIGINT (Ctrl+C). In your case that would be something like: trap "kill -2 $pid1 $pid2" SIGINT Just place it before the wait command.
Interrupt child processes from bash script on Ctrl+C
1,389,268,938,000
I'm trying to understand what the difference is between DRM (Direct Rendering Manager) and a graphics driver, such as AMD or Nvidia GPU drivers. Reading the DRM wiki[1], it seems to me like DRM is basically a graphics hardware driver, however this doesn't explain the existence of proprietary or FOSS graphics drivers f...
"Graphics driver" can mean any number of things. The way X (the graphical windowing system) works is that there is a central X server, which can load modules ("X drivers") for different hardware. Like vesa, fbdev, nvidia, nouveau, amdgpu. Some of these drivers can work on their own (vesa). Some need linux kernel drive...
What's the difference between DRM and a graphics driver?
1,389,268,938,000
Error when i try to upgrade Debian based distro After this operation, 347 MB of additional disk space will be used. Do you want to continue? [Y/n] y sh: 0: getcwd() failed: No such file or directory sh: 0: getcwd() failed: No such file or directory if I cancel the process with ctrl+c I have the following message: E: ...
The error code is obvious: someone removed your current working directory (the directory from which you started the command). I recommend to type cd to go to your home directory and retry the command. If someone removed your home directory, chdir to / or /tmp/.
Error sh: 0: getcwd() failed: No such file or directory when I try to upgrade Debian
1,389,268,938,000
I'm writing an initramfs-script and want to detect usb-sticks as fast as possible. When I insert an usb 2.0 stick, the detection of idVendor, idProduct and USB class happens within 100 ms. But the scsi subsystem does not "attach" until about 1 s has passed and it takes another 500 ms before the partition is fully reco...
You can change the timeout by writing to /sys/module/usb_storage/parameters/delay_use. For older usb disks, a settle delay of 5 seconds or even more may be needed (and 5 was the default until it was reduced to 1 second in 2010), presumably because the controller is starved of power while the disk motors are initializi...
Why does it take so long to detect an usb stick?
1,389,268,938,000
In output of iostat there is a steal field, according to man page the field is used to: Show the percentage of time spent in involuntary wait by the virtual CPU or CPUs while the hypervisor was servicing another virtual processor. But what does that mean? Does it means the kernel itself is too busy to manage a cpu, ...
The hypervisor means the layer that manages a virtual environment, like VMware, XEN or VirtualBox. So the steal field, should be an interesting field to monitor, to detect problems or oversubscription of a virtualised environment. The field itself means the time the VM CPU has to wait for others VMs (virtual machines...
iostat - What does the 'steal' field mean?
1,389,268,938,000
Because I now and then need to use scandinavian letters despite using US Dvorak as my layout, I would like to use Caps Lock as a compose key. (I don't need Caps Lock at all, I'm not a forum troll) How would one accomplish this? Using Linux Mint 17 with xfce, if that makes a difference. For the record, I am the only us...
X11 (classic) Run the program xev from a terminal to see the keycode sent by the CapsLock key. That's the number just after keycode on the third line from the KeyPress event line corresponding to pressing the key. On a PC, the keycode is 66. Create a file called .Xmodmap in your home directory and add the line keycode...
Remapping Caps Lock to Compose
1,389,268,938,000
I have two PPP peers, dsl-line1 and dsl-line2 which are configured with pppd on Ubuntu (Server) Linux. They are brought up by the /etc/network/interfaces file with the auto thingy however each PPP connection chooses the name pppX where X varies depending on which comes up first. I would like to make it such that dsl-l...
The best bet I found was the "unit" option in the /etc/ppp/peers/... file. This option is an integer which names the interface pppX where X is the int after "unit". I ended up just naming the interfaces pppX in /etc/network/interfaces and using "unit" in the peers files to ensure they are named that way.
Naming PPP interfaces
1,389,268,938,000
When I switch to a TTY and turn on the caps lock, the caps lock LED on my keyboard isn't turning on. On X it works fine. When I activate caps lock and then switch to a TTY and then press caps lock (on the TTY) the LED stays on (Even though the TTY keeps it's own track of the caps lock). So it seems the TTYs don't care...
This is a long standing Debian bug. It seems to relate to an underlying kernel bug which has been long since fixed. The problem seems to have been that Caps_Lock did not work for non-ASCII characters, so the workaround was to map Shift_Lock or CtrlL_Lock to the caps lock key instead. On the Debian side the issue is cr...
caps lock led not working on Linux console
1,389,268,938,000
On the output of the mount command on my system there are some lines like the following: /dev/sda2 on /var/log type ext3 (rw,relatime,errors=continue,barrier=1,data=ordered) And inside the parenthesis as you can see it says errors=continue. What does this mean? Is there any error on the sda2 partition? Shall i consid...
No, that means that if there is an error, the system will ignore it. There are three possible values for the errors option: continue (ignores the error) remount-ro (remount the filesystem read-only) panic (kernel panic). Read man 8 mount for more informations.
What does the errors=continue mount option mean?
1,389,268,938,000
I need a small distro, that is stable. I don't need a full X server or window manager, I only need it to run one single application with a basic UI that consists of a viewport. I would like for the distro to be as small as possible. 700 mb or less would be ideal. Is their a base distro of ubuntu or similar that I ca...
Have a look at TinyCore Linux. It comes in two variants, one CLI and one including X. The X version including a window manager and a simple desktop is about 12MiB. If you don't need a window manager, you can just start X and your application. A window manager is not required.
Need small distro without a desktop or windows manager, just to run a single graphical app [duplicate]
1,389,268,938,000
top - 08:43:16 up 96 days, 22:16, 1 user, load average: 4.03, 3.92, 3.98 Tasks: 199 total, 1 running, 198 sleeping, 0 stopped, 0 zombie Cpu0 : 0.0%us, 0.5%sy, 50.0%ni, 49.5%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st Cpu1 : 0.0%us, 3.9%sy, 46.8%ni, 49.3%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st Cpu2 : 0.0%us, ...
It's been over four years, and to be fair, I completely forgot about this question and only came back because I saw that I had received a Notable Question badge for it. The problem was tangentially related to hyperthreading, but as I continually pointed out to responders, that was not the cause for the 50% idling. The...
Top says 100% CPU used, but 50% of cores idle?
1,389,268,938,000
I have downloaded the ChromePlus tarball and extracted it to my home directory. The extracted folder contains an executable that I can double-click to launch ChromePlus. So I assume I do not need to any extra things to install it. I'm new to Linux. Where should I place the ChromePlus directory? It's currently sitting ...
By convention, /opt is used for manually installed programs with self contained directories. Programs in self contained directories will not show up in your PATH by default, but generally this is solved by creating symlinks in /usr/local/bin to any binaries under /opt. As implied above, /usr/local is the other locati...
Where should I place a downloaded tarball?
1,389,268,938,000
I use both man and --help in Bash programming to get help. For example, to get information about usage of ls command, I may use man ls Or ls --help Both give some what similar output. What is the difference between these two?
For one, --help is not a command, it is an argument that is often given to a command to get help using it. Meanwhile, man is a command, short for "manual". Manual pages are installed by many programs, and are a common way to find help about commands, as well as system calls, (e.g. fork()). If a program installs a manu...
Difference between 'man ls' and 'ls --help'?
1,389,268,938,000
I would like to setup a Linux system with ScrotWM as the window manager, but I noticed that X is aware of only a few fonts. I would like to have UTF-8 fonts that support multiple languages, including Asian languages like Japanese and Traditional Chinese. How do I install fonts so that X can show them? What kind of fon...
Step-by-step manual how to install to Linux the multiple fonts from the specific folder: Open the Terminal application and gain root privileges by typing su and the correct root password. Go to the folder with the fonts by using cd command, e.g suppose, the user font folder is in Downloads: cd /home/**user_name**/Dow...
How to install fonts for X?
1,389,268,938,000
Is it possible to set Linux kernel sysctl settings (those usually set in /etc/sysctl.d) using kernel command line (those visible in /proc/cmdline)? (Using grub config file /etc/default/grub variable GRUB_CMDLINE_LINUX="...".)
Sysctl parameters can be set via the kernel command-line starting with kernel version 5.8, thanks to Vlastimil Babka from SUSE. sysctl.*= [KNL] Set a sysctl parameter, right before loading the init process, as if the value was written to the respective /proc/sys/.....
How to set sysctl using kernel command line parameter?
1,572,946,589,000
I have two questions about the Linux kernel. Specifically, does anybody know exactly, what Linux does in the timer interrupt? Is there some documentation about this? And what is affected when changing the CONFIG_HZ setting, when building the kernel? Thanks in advance!
The Linux timer interrupt handler doesn’t do all that much directly. For x86, you’ll find the default PIT/HPET timer interrupt handler in arch/x86/kernel/time.c: static irqreturn_t timer_interrupt(int irq, void *dev_id) { global_clock_event->event_handler(global_clock_event); return IRQ_HANDLED; } This calls ...
Linux timer interrupt
1,572,946,589,000
I faced an urge to run different scripts simultaneously on different servers. (+/- 2 seconds not a problem) The condition is to launch the scripts by the invocation from the primary server, and NOT by the Cron schedule. I tried SSH, but this way I must wait till the script finishes running on the remote server and on...
GNU screen will allow you to execute remote jobs without staying connected to the server, except on systems where systemd kills all processes upon logout1. Specifically, you can use: #!/bin/sh ssh server1 screen -d -m command1 ssh server2 screen -d -m command2 # ... Each local ssh session terminates immediately afte...
Run bash on a remote server without waiting till the end
1,572,946,589,000
According to this post can stat be used to give the atime on Linux, but FreeBSD 10.1 doesn't have the GNU stat. How do I list the atime for files?
ls -lu where -l will provide a long listing format and -u will sort by access time.
How to list atime for files?
1,572,946,589,000
In DMESG I see: [sdb] Attached SCSI removable disk How does Linux decide what is removable and not removable? Is there a way I can look up if a device is "removable" or not other than the log, for example somehwere in /sys or /proc?
All block devices have a removable attribute, among other block device attributes. These attributes can be read from userland in sysfs at /sys/block/DEVICE/ATTRIBUTE, e.g. /sys/block/sdb/removable. You can query this attribute from a udev rule, with ATTR{removable}=="0" or ATTR{removable}=="1". Note that removable (t...
How to tell if a SCSI device is removable?
1,572,946,589,000
I am trying to install a Linux kernel (3.8.1) from source in a Fedora distribution. The kernel is a vanilla one. I follow the kernel's build instructions closely that is: make menuconfig make sudo make modules_install install sudo grub2-mkconfig -o /boot/grub2/grub.cfg Everything in /boot seems fine. I can see System...
Easiest way to get a working kernel configuration is to just copy Fedora's .config over and then do a make oldconfig to configure it. The configuration is found at /boot/config-*
Self-built kernel: failed to mount /dev: No such device
1,572,946,589,000
by doing this, # btrfs subvolume snapshot /mnt/1 /mnt/1/snapshot # tree /mnt/1 /mnt/1 ├── a ├── snapshot │ ├── a │ └── subv └── subv └── b 3 directories, 3 files We can create snapshot from /mnt/1 on btrfs. My question is: what is advantage of using snapshot , than using rsync to simpaly backup filesystem?
Snapshotting can be seen as a special case of, but distinct from, copying. I'm not really familiar with the specifics of Btrfs, but the following applies to ZFS, from which Btrfs draws much inspiration. Apparently Btrfs snapshots are actually read/write, making them more similar to ZFS file system clones, but that doe...
How are filesystem snapshots different from simply making a copy of the files?
1,572,946,589,000
I have a main script that I'm running, and from it I have a second "slow process" I want to kick off, and "do something" in the main script if it doesn't complete in the time limit -- depending on if it completed or not. N.B. If the "slow process" finishes before my time limit, I don't want to have to wait an entire t...
With ksh/bash/zsh: { (./slowprocess.sh >&3 3>&-; echo "$?") | if read -t 3 status; then echo "Cool it completed with status $status, do stuff..." else echo "It didn't complete, do something else..." fi } 3>&1 We duplicate the original stdout onto fd 3 (3>&1) so we can restore it for slowproc...
timeout without killing process in bash
1,572,946,589,000
This is a server that is running on Vmware ESXi: SERVER:/root # cat /etc/SuSE\-release SUSE Linux Enterprise Server 11 (x86_64) VERSION = 11 PATCHLEVEL = 2 SERVER:/root # rpm -qa|grep -i vmware vmware-open-vm-tools-common-8.0.3-258828.sles1...
You can get this info only from the vSphere Client.. :\ (but fixme, if there is a way.. I just asked many people, and the conclusion was this..) p.s.: maybe: vmware-toolbox-cmd can do this, but I can't see it on the servers: http://www.virtuallyghetto.com/2011/01/how-to-extract-host-information-from.html where does...
How to get CPU info on a vmware guest
1,572,946,589,000
I was wondering if there is an easy way to find the maximum size that is supported by Linux sockets? (Is this configurable? If so where?) For example, most of the socket examples found on the web send "Hello Socket" or some such other small string, however if I put the whole of War And Peace into the socket, when does...
net.core.rmem_max and net.core.wmem_max are your thing. You can examine their values with # sysctl net.core.rmem_max and set them with # sysctl -w net.core.rmem_max=8388608 These are the socket buffer sizes, when receiving and sending, respectively. They have default values, too, - rmem_default and wmem_default.
Size of data that can be written to / read from sockets
1,572,946,589,000
I am writing scripts to initialize and configure a large system with many components. Each component has its own log file. I would like to change the color of the component file name to red whenever an error occur on its installation/configuration. How can I do it?
Google will find you the answer. Print Hello world in red: echo -e "\033[0;31mHello world\033[0m" Explained <esc><attr>;<foreground>m <esc> = \033[ ANSI escape sequence, some environments will allow \e[ instead <attr> = 0 Normal text - bold possible with 1; <foreground> = 31 30 + 1 = Color red...
Change the color of the file name text
1,572,946,589,000
When I ssh as root, my shell is bash, but when it's a non-root user it is sh. How can I make them both to use bash? This actually goes against the logic in this question: Why root's default shell is configured differently with other normal user account's default shell?
Please see man usermod. An example would be sudo usermod -s /bin/bash username.
different shell for root and non-root user
1,572,946,589,000
I read many tutorials about the use of kill command, mostly 3 approaches kill -15 <pid> kill -SIGTERM <pid> kill -TERM <pid> For scripts purposes and for portability with macos too, the code numbers are not going to be used. Because kill -l in macos is different than Linux. So here enter in play the signal names. Que...
The most portable variant is kill -s TERM -- … That’s the form specified in POSIX with no extensions: -s followed by the signal’s name, as defined in signal.h, with no SIG prefix, or 0 for the “null” signal (used to check for the existence of a process with a given identifier). SIGTERM is the default signal, so sendi...
What is correct or suggested approach to send the signal name through 'kill' command?
1,572,946,589,000
I try to run simple test case on linux operating system with dd command . I create a simple disk image with this command : dd if=/dev/urandom of=disk.img bs=1M count=100 This is First Test : Now I run this commands : dd if=disk.img of=output_1 bs=1k count=4 dd if=disk.img of=output_2 bs=4k count=1 md...
The skip parameter is in (input) blocks, not in bytes, as written in the man page: skip=N skip N ibs-sized blocks at start of input In the first case the skipped part is: 1500 * 1KiB = 1536000 bytes The second case: 1500 * 4KiB = 6144000 bytes As long as the involved values divide exactly you can adjust. For the...
Linux dd problem on difference result for same blocks
1,572,946,589,000
I stumbled upon Lynis - a security auditing tool for linux - and ran it on my Raspberry Pi to see if I could harden it a bit more. I got one warning in the Authentication group that confuses me. - sudoers file [ FOUND ] - Permissions for directory: /etc/sudoers.d ...
Lynis expects /etc/sudoers.d to be unreadable by “others”, i.e. rwx[r-][w-][x-]---. If you run chmod 750 /etc/sudoers.d the warning will disappear. The information should have been logged in the Lynis log file...
Why do I get a warning for the sudoers.d when doing an audit with Lynis?
1,572,946,589,000
I'm looking for a file system that stores files by block content, therefore similar files would only take one block. This is for backup purposes. It is, similar to what block-level backup storage proposes such as zbackup, but I'd like a Linux file system that allows to do that transparently.
Assuming your question is about data deduplication, there are a few file systems which support that on Linux: ZFS, with online deduplication (so data is deduplicated as it is stored), but with extreme memory requirements which make the feature hard to use in practice; Btrfs, with “only” out-of-band deduplication, alb...
Is there a block-level storage file system?
1,572,946,589,000
Recently there is a popular github repo called lsix, and it's using sixel graphics to display images inside a terminal. Currently I am using rxvt-unicode as my terminal emulator, but it seems not to work well with sixel. Anyone know how to make it support sixel? (I am using Ubuntu 18.04 LTS FYI)
Besides using the rxvt-unicode-sixel fork, it might be possible to implement sixel by writing a perl extension. Documentation for that is in the urxvtperl(3) manpage. I don't know much about sixel but I imagine it's a matter of: intercepting the sixel escape sequences, interpreting them and not letting them pass thro...
Is there any way to let urxvt support sixel?
1,572,946,589,000
I'm working with Docker in action's book, and I have seen the term "process accounting" several times. I am in a containerization of the application context. I would like to know more about this concept of process accounting. Google found me some finance accounting articles; I am looking for the meaning related to c...
The Linux kernel has a built-in process accounting facility. It allows system administrators to collect detailed information in a log file each time a program is executed on a Linux system. Then the administrator can analyze the data in these log files and find a conclusion. To shed more light on this term, let me giv...
What does "process accounting" mean in Linux?
1,572,946,589,000
I am searching for files by finding a partial file name: find /script -name '*file_topicv*' /script/VER_file_topicv_32.2.212.1 It works, but not when the partial file name is a variable: var=file_topicv find reported file not found, (in spite of the file existing): find /script -name '*$var*' What is wrong here? ...
The first double-quoted one should work: $ touch asdfghjkl $ var=fgh $ find -name "*$var*" ./asdfghjkl Within single quotes ('*$var*'), the variable is not expanded, and neither is it expanded when the dollar sign is escaped in double quotes ("*\$var*"). If you double-escape the dollar sign ("*\\$var*"), the variable...
How to use find command with variables
1,572,946,589,000
Hy there, I am having problem in connecting my raspberry pi to a wifi dongle. I have followed a lot of tutorials from internet but no success so far. My WIFI dongle can scan the networks but it's not connecting to any network.Here is what my configuration file looks like ctrl_interface=DIR=/var/run/wpa_supplicant GROU...
Edit your wpa_supplicant.conf , change the following lines: network={ ssid "noname" psk"zong4gisbest" to: network={ ssid="noname" #psk="zong4gisbest" psk=ead5b0b7e82e1a68f01e9a17a2a7719ec24575c89bb5b5805e4ae49c80daa983 } save then run wpa_supplicant -iwlan0 -D wext -c/etc/wpa_supplicant/wpa_suppl...
How to get the wifi working with r8188eu driver on my raspberry pi?
1,572,946,589,000
I need to print the 10 processes that are using the most CPU. Also I need to print their ID, and the command they were started with. What I've found is that the command ps -ax -u prints all the processes and their %CPU usage. The command ps -ax -u --sort pcpu prints all the processes sorted by the %CPU usage, from t...
to print 10 processes, that use the most CPU ps -aux --sort -pcpu | head Sorting syntax is [+|-]key[,[+|-]key[,...]]. The "+" is optional since default direction is increasing numerical or lexicographic order. Identical to k. For example: ps jax --sort=uid,-ppid,+pid head - will print the first/top 10 lines...
Print processes, sorted by usage of CPU
1,572,946,589,000
In particular, I'd like to add a fd flag and a branch in a couple of fd-handling syscalls that should be used if the flag is set instead of the current code. I think the only thing that matters here for the purposes of this question is that this should be a generic rather than hardware specific modification. How do I ...
eudyptula-boot is quite handy for this; its introductory blog post has more details, but basically it allows you to boot a VM using the kernel you wish to test, and your existing filesystems (using overlayfs). That way you can quickly check a kernel without rebooting, and you still have access to all your files. The o...
How do I quickly build and test the kernel if I want to modify a system call
1,572,946,589,000
I would like to read a bit of the source code to try and understand how it all fits together, but cannot see where to start. Which file in the Linux source code is the main file used to compile the kernel? I was half expecting to find a kernel/main.c, but there are many files under kernel/ and I cannot see which one i...
The handover from the bootloader to the kernel necessarily involves some architecture-specific considerations such as memory addresses and register use. Consequently, the place to look is in the architecture-specific directories (arch/*). Furthermore, handover from the bootloader involves a precise register usage prot...
Looking at the source files, where does Linux start executing?
1,572,946,589,000
I'm trying to understand Linux file system, and one of the question is: 1- Why there are multiple folders for executable files: /usr/bin, /usr/sbin/ and /usr/local/bin? Is there any differences between them ? 2- If I have an executable file and I want to add it to my system, which of the third latter locations is the...
Run man hier from the command line to get the answer to your first question. It depends. See /usr/bin vs /usr/local/bin on Linux
Why there are multiple folders for executable files in Linux? [duplicate]
1,572,946,589,000
I have a read-only file, F. A program, P, that I'm not the author of, needs to read F. I want the content of F to come from another 'generator' program, G, whenever P tries to read F (taking F to be an ordinary file) and not any earlier. I tried doing the following: $ mkfifo /well-known/path/to/F # line #1 $ G > ...
FUSE + a soft-link (or a bind mount) is a solution, though I would not consider it "elegant", there's quite a lot of baggage. On *BSD you'd have the simpler option of portalfs, with which you could solve the problem with a symlink – there was a port of it to Linux many years ago, but it seems to have been dropped, pre...
Dynamic file content generation: Satisfying a 'file open' by a 'process execution' [duplicate]
1,572,946,589,000
I'm currently attempting to remove the usbserial module in order to install a new driver module. When I attempt to remove the module I get the following issue: [root@localhost xr21v141x-lnx-3.0-pak]# modprobe -r usbserial FATAL: Module usbserial is builtin How can I remove the usbserial module?
That means the module was compiled into the kernel. If you want to be able to unload it, you will have to compile a new kernel and have it built as a dynamically (un)loadable module instead.
Removing builtin modules in Linux
1,572,946,589,000
I mounted a FAT32 drive onto my Linux computer using the following terminal command: > sudo mount /dev/sdb1 /media/exampleFolderName -o dmask=000, fmask=111 I did this so I could share / edit the files over a network connection. Unfortunately Linux doesn't support per file permissions in FAT32 format, so this sets th...
You probably want to add a line like /dev/sdb1 /media/drive1 vfat dmask=000,fmask=0111,user 0 0 to /etc/fstab. The additional ,user in the options field allows any user to mount this filesystem, not just root.
Linux, fat32 and etc/fstab
1,572,946,589,000
What are some ways I could interest my friends, girlfriend, parents, etc. to learn and use Linux? It's usually not feasible for them to let me install Linux on their computers, even for a dual boot. Are there other things to get them hooked?
A good way to demonstrate Linux features and for others to play around with, is to boot off a live CD for your Linux distribution. That way no one has to worry about partitioning any hard drive or installing any (corrupted,evil) software until they eventually choose to go with it. The fact that it's for free to try ou...
How to get someone interested in using Linux [closed]
1,572,946,589,000
I have a file named 'sourceZip.zip' This file ('sourceZip.zip') contains two files: 'textFile.txt' 'binFile.bin' I also have a file named 'targetZip.zip' This file ('targetZip.zip') contains one file: 'jpgFile.jpg' In linux, what bash command shall I use to copy both files ('textFile.txt', 'binFile.bin') from the so...
Using the usual command-line zip tool, I don't think you can avoid separate extraction and update commands. source_zip=$PWD/sourceZip.zip target_zip=$PWD/targetZip.zip temp_dir=$(mktemp -dt) ( cd "$temp_dir" unzip "$source_zip" zip -g "$targetZip" . # or if you want just the two files: zip -g "$targetZip" textFi...
Copy a File From One Zip to Another?
1,572,946,589,000
Just installed Debian 12.0.0. Upgrade from 11.2 didn't work, so installed clean from Bookworm DVD. sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target DOES NOT prevent screen from going to black even though sudo systemctl status sleep.target suspend.target hibernate.target hybrid-slee...
This turns out to be a situation where the command line is apparently not the best way to go. These four steps worked: Click the far upper right corner power button. Click the settings gearwheel in the resulting dropdown box. Click "Power" in the left menu of the resulting popup settings window. Under "Power Saving O...
Disabling Suspend, etc. on Debian 12
1,572,946,589,000
In order to verify a password hash we can use openssl passwd as shown below and explained here openssl passwd $HASHING-ALGORITHM -salt j9T$F31F/jItUvvjOv6IBFNea/ $CLEAR-TEXT-PASSWORD However, this will work only for the following algorithm: md5, crypt, apr1, aixmd5, SHA-256, SHA-512 How to calculate the hashing passwo...
perl's crypt() or python3's crypt.crypt() should just be an interface to your system's crypt() / crypt_r(), so you should be able to do: $ export PASS=password SALT='$y$j9T$F31F/jItUvvjOv6IBFNea/$' $ perl -le 'print crypt($ENV{PASS}, $ENV{SALT})' $y$j9T$F31F/jItUvvjOv6IBFNea/$pCTLzX1nL7rq52IXxWmYiJwii4RJAGDJwZl/LHgM/U...
Verifying a hashed salted password that uses yescrypt algorithm
1,572,946,589,000
I have a command to forward a port from my computer to a server, as follows: ssh -L 8000:localhost:8888 myserver.com I would like to run this command in background. I don't need to enter user and password since I already setup a public key. I tried adding & at the end, as follows: ssh -L 8000:localhost:8888 myserver....
You mention ssh -f, which is correct, but you missed -N, which is the remaining piece of the puzzle: -N Do not execute a remote command. This is useful for just forwarding ports. [...] So close! Try this ssh -fN -L 8000:localhost:8888 myserver.com
SSH Tunnel (Port forwarding) in background
1,572,946,589,000
I just got a new display (Samsung LC27JG50QQU, 1440p, 144hz) which is plugged into my AMD Radeon HD 6950 (DVI-D, DVI-I, HDMI 1.4, 2x Mini DisplayPort) graphics card using HDMI. However, it only lets me set 1080p max in my display settings. Cable and monitor were fine on 1440p with my MacBook Pro. I am running Linux Mi...
First create the appropriate modeline with cvt $ cvt 2560 1440 # 2560x1440 59.96 Hz (CVT 3.69M9) hsync: 89.52 kHz; pclk: 312.25 MHz Modeline "2560x1440_60.00" 312.25 2560 2752 3024 3488 1440 1443 1448 1493 -hsync +vsync Then add the mode using xrandr --newmode $ xrandr --newmode "2560x1440_60.00" 312.25 2560 27...
How to enable 2560x1440 option for display in Linux Mint?
1,572,946,589,000
Following on from another user's question I've bumped into a quirk of Linux filesystem permissions that I can't easily rationalize: sudo mkdir ~/foo ~/foo/bar sudo touch ~/baz mkdir ~/my_dir chown 700 ~/my_dir # this is fine mv ~/baz ~/my_dir # renaming is fine mv ~/foo ~/bob # Moving caused: Permission denied mv ~/bo...
This is one of the situations documented to lead to EACCES: oldpath is a directory and does not allow write permission (needed to update the .. entry). You can’t write inside bob, which means you can’t update bob/.. to point to its new value, my_dir. Moving files doesn’t involve wri...
Why can't you move another user's directory when you can move their file?
1,572,946,589,000
AFAIK, Linux has a page cache to improve performance (example, if you open a file, linux caches that file in RAM), then if file is requested again and it's cached, the OS avoids read the file from disk and returns the file from cache... My question is: if you have a file in tmpfs and you interact with that file (read)...
Does a tmpfs use Linux Page Cache? tmpfs and the page cache are two sides of the same coin. As described in https://www.kernel.org/doc/Documentation/filesystems/tmpfs.txt (emphasis mine) tmpfs puts everything into the kernel internal caches and grows and shrinks to accommodate the files it contains and is able ...
Does a tmpfs (/dev/shm) use Linux Page Cache? If it does, then how?
1,572,946,589,000
Consider the following folder structure: . ├── test1 │   ├── nested1 │   ├── testfile11 │   └── testfile12 └── test2 ├── nested1 -> /path/to/dir/test1/nested1 └── testfile21 test2/nested1 is a symlink to the directory test1/nested1. I would expect, if it ...
The commands cd and pwd have two operational modes. -L logical mode: symlinks are not resolved -P physical mode: symlinks are resolved before doing the operation The important thing to know here is that cd .. does not call the syscall chdir("..") but rather shortens the $PWD variable of the shell and then chdirs to...
How is .. (dot dot) resolved in bash when cwd is a symlink to a directory [duplicate]
1,572,946,589,000
The Linux man page for network namespaces(7) says: Network namespaces provide isolation of the system resources associated with networking: [...], the /sys/class/net directory, [...]. However, simply switching into a different network namespace doesn't seem to change the contents of /sys/class/net (see below for how...
Let's look into man 5 sysfs: /sys/class/net Each of the entries in this directory is a symbolic link representing one of the real or virtual networking devices that are visible in the network namespace of the process that is accessing the directory. So, according to this manpage, the output of ls /sys/c...
Switching into a network namespace does not change /sys/class/net?
1,572,946,589,000
I'm trying to compile a demo project, what is using OpenGL. I'm getting this error message: But I have everything: What is happening? If I have all of the dependencies, why does it not compile? I use Solus 3.
The meaning of -lglut32 (as an example) is, load the library glut32. The result of the ls you execute showed that you have the header file for glut32 In order to solve the problem of cannot find -l-library-name You need: To actually have the library in your computer Help gcc/the linker to find the library by providin...
gcc /usr/bin/ld: cannot find -lglut32, -lopengl32, -lglu32, -lfreegut, but these are installed
1,572,946,589,000
I have the following file variable and values # more file.txt export worker01="sdg sdh sdi sdj sdk" export worker02="sdg sdh sdi sdj sdm" export worker03="sdg sdh sdi sdj sdf" I perform source in order to read the variable # source file.txt example: echo $worker01 sdg sdh sdi sdj sdk until now every thing is perfec...
You have export worker01="sdg sdh sdi sdj sdk", then you replace = with a space to get export worker01 "sdg sdh sdi sdj sdk". The space separated fields in that are export, worker01, "sdg, sdh, etc. It's probably better to split on =, and remove the quotes, so with just the shell: $ while IFS== read -r key val ; do ...
bash + read variables & values from file by bash script
1,572,946,589,000
Why is there a type of $TERM called linux described in /etc/termcap? Why and when was it created and what's the point of it? Couldn't we just stay with vt-generic? Is linux just a customary name and a set of capabilities for a Linux console (like, say, etc or home are a customary names for directories under root and n...
The terminal description is named for Linux, which provides its own console emulator (as do several other kernels). Except for FreeBSD, all of the Linux- and modern BSD-platforms get "termcap" by deriving it from the terminfo database in ncurses. Console entries are specific to the systems in which they are implement...
Origin of /etc/termcap linux entry
1,433,997,497,000
I have switched recently to Fedora 22 from Ubuntu Gnome. In Ubuntu gnome, when my Kodi media center used to hang while in full-screen, I used to press Ctrl+Alt+F1 to switch to terminal. Then find the process ID with ps aux | grep process_name and then kill the process and use Ctrl+Alt+F7 to return to gnome. What s...
You can try Ctrl+Alt+F2, or F3 or F4... Unless it was changed in Fedora 22, graphical server is started on first terminal of Fedora instead of 7th in Ubuntu. P.S. If that works, use Ctrl+Alt+F1 to go back to graphical server.
Switch to a text console in Fedora
1,433,997,497,000
CentOS Linux release 7.0.1406 (Core) / Linux 3.10.0-123.13.2.el7.x86_64 Last week, I noticed that when I tried to restart, there was an option to Install Updates & Restart. I do not recall manually installing any updates. Because this computer is for work, I would rather not upgrade software where a previous version i...
I found out that in Centos 7 yum-cron has nothing to do with the "Install Updates & Restart" prompt. I don't need or want automatic updates too. After some tricky research I discovered this feature is provided by a gnome package "packagekit". Three solutions: uninstall packagekit altogether (my favourite) disable pac...
How to disable automatic updates in CentOS 7?
1,433,997,497,000
Trying lots of different Linux distributions on all kinds of hardware, I find myself typing commands like this quite often: sudo dd if=xubuntu-13.10-desktop-amd64.iso of=/dev/sdc bs=10240 Needless to say, sooner or later I will mistype the destination and wipe a harddrive instead of the intended USB drive. I would li...
I think you can use UDEV to do what you want. Creating a rules file such as/etc/udev/rules.d/99-thumbdrives.rules you'd simply add a rule that will allow either a Unix group or user access to arbitrary USB thumb drives. KERNEL=="sd*", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", OWNER="<user>", GROUP="<group>", MODE="066...
Writing raw images safely to USB sticks