date
int64
1,220B
1,719B
question_description
stringlengths
28
29.9k
accepted_answer
stringlengths
12
26.4k
question_title
stringlengths
14
159
1,406,268,808,000
Is there some general way to find out the name of the driver which I have to install on my linux system given only the hardware name? Maybe some centralized webpage or application which gatters all the hardware information and it's related dirver? Or all which I can do is search it on a web browser? What do you do in ...
LKDDb You can search for drivers that are included in the Linux Kernel here, http://cateee.net/lkddb/web-lkddb/. The primary page is here, http://cateee.net/lkddb/. About LKDDb LKDDb is an attempt to build a comprensive database of hardware and protocols know by Linux kernels. The driver database includes numeric...
Find driver (which is not automatically installed) for a specific hardware
1,406,268,808,000
I'd like to put a script in /etc/pm/suspend.d/ that needs network access (for a very short time) before allowing the system to suspend. However, even with scripts named "001_something" in /etc/pm/suspend.d/ and /usr/lib/pm-utils/sleep.d/ I do not get any network access. It seems this is disabled before the scripts are...
1. Quirks? First I would confirm that your suspend is functioning correctly. Take a look at the quirks page and confirm that your suspend is functioning correctly and not just seeming like it's working right. Sleep Quirk Debugger 2. Is your 001_something script executable? Check to make sure that your 001_something ...
pm-utils: No network in suspend scripts?
1,406,268,808,000
This is for academic purpose. I want to know which commands are executed when we do something in GUI, for example creating a folder. I want to show that both the mkdir shell command and create folder option from GUI does the same thing.
You can observe what the process does with the strace command. Strace shows the system calls performed by a process. Everything¹ a process that affects its environment is done through system calls. For example, creating a directory can only be done by ultimately calling the mkdir system call. The mkdir shell command i...
How to know which commands are executed when I do something in GUI
1,406,268,808,000
Here's my problem: I have a laptop running Arch that I just keep on at home. It's got a good 4 hour battery life, but sometimes my daughter is playing near where it's kept and ends out pulling the plug. Well, when I get home 5 hours later, my laptop had a hard shutdown. Additionally, sometimes I'll leave it suspended ...
Sounds like you want suspend-to-both/hybrid suspend which should do all the steps of hibernating, including writing RAM to disk, but not actually turn the machine off; instead, it'll go into S3 (standby). If you wake the machine up before the battery dies, it'll be fairly quick; if the battery dies, it'll be just as i...
Is it possible to automatically wake from suspend?
1,406,268,808,000
I have a CentOS release 5.4 linux box on Amazon EC2 that I'm trying to set up to be monitored via Nagios. The machine is in the same security group as the nagios server, but it seems to be unresponsive to pings or NRPE checks, although apparently port 22 is open. The CentOS box can ping itself using it's internal IP a...
I dont' think that it's related to ping problem, but if you want to put selinux temporary off, you have this option: setenforce 0 it put selinux from enforcing to permissive mode, to check its condition run sestatus to diable selinux permanently you can use system-config-securitylevel or edit with nano or vi /etc/se...
What prevents a machine from responding to pings?
1,406,268,808,000
Inside the /etc/fstab file, in the sixth column, there is a number that corresponds to whether a filesystem should be scanned for errors. Possible values are: 0 - skip 1 - high priority 2 - low priority Why was fsck 'priority' introduced in /etc/fstab?
The field exists so you can define the order in which filesystems are checked. Different partitions on the same drive should not be checked at the same time since the IO going to each filesystem will compete with one another, and slow the whole process down. Filesystems on different physical disks could be set to ch...
Why was fsck priority introduced in /etc/fstab?
1,406,268,808,000
Who is responsible for creating the "/sys/class/drm" directory structure, more specifically the "/sys/class/drm/card0-LVDS-1" directory? I am using kernel-2.6.38 and an nVidia card.
The DRM module is responsible for that subtree in SysFS. You can browse the source code for that in drivers/gpu/drm/drm_sysfs.c. The subdirectories are per-connector, with a name of the form card%d-%s with %d replaced by an index (that I know nothing about) and %s replaced with the connector name. Five files per devic...
/sys/class/drm directory structure
1,406,268,808,000
I want to write a game which runs in a terminal. I do some terminal coloring and wanted to use some unicode characters for nice ascii art "graphics". But a lot of unicode characters aren't supported in the linux terminal (the non-X terminal, I don't know how you call it... VT100? I mean the terminal which uses the tex...
That terminal is called the Linux console, or sometimes a “vt” (short for virtual terminal). The terminology can be confusing, especially since it's used inconsistently and sometimes incorrectly. You can find more information on terminology by reading What is the exact difference between a 'terminal', a 'shell', a 'tt...
Charset / font in the Linux console
1,406,268,808,000
I do not understand how namespaces interact with /proc. I assumed that /proc returns values based on the process that queries them. For example, let's determine the PID of the current process inside the global PID namespace: $ bwrap --bind / / readlink /proc/self 6182 This makes sense to me. However, when I isolate r...
This is one of the gotchas of namespaces. With bwrap --bind / / --unshare-pid readlink /proc/self you’ve created a new PID namespace, and a new mount namespace (because bwrap does that by default), but you’re explicitly bind-mounting the external / into that mount namespace. The result is that, inside the new mount n...
How does /proc interact with PID namespaces?
1,406,268,808,000
I want to make sure that only one script can be run by any regular user of a system at a time. There can be multiple users logged in and each of them should only be able to run a command after any running commands of other users have finished. A long time ago on UNIX I was using the batch command with a proper "one t...
flock is really excellent for this. You can use flock in a wrapper around your shell script, use it on the command line, or incorporate it into your script itself. The best thing about flock is that while it waits, it doesn't wait in a busy loop. It also always cleans up the lock when your process exits / flock exi...
How to serialize command execution on linux?
1,406,268,808,000
Say I have a USB device with a vendor id (VID) of 0123 and a product id (PID) of abcd. 0123:abcd According to USB.org, product id assignment is entirely up to a manufacturer. Product IDs (PIDs) are assigned by each vendor as they see fit So there's nothing stopping a misguided vendor from selling a wide range of US...
There are some other pieces of information which can be used to select a device driver: a version number, the device class, subclass and protocol, and the interface class, subclass and protocol. (For the driver side of things on Linux, look at the USB_DEVICE macros. You can get an idea of the information available by ...
Do vendor id and product id alone determine the driver used for a USB device?
1,406,268,808,000
I'm not sure if I'm thinking about this the right way (and please correct me if I'm wrong), but the following is my understanding of ftrace. In /sys/kernel/debug/tracing, there are the following files: set_ftrace_filter which will only trace the functions listed inside, set_ftrace_notrace which will only trace the...
I figured out how to do what I was describing, but it was a bit counter-intuitive, so I'm posting the answer here for people who might hit this page when searching (tl:dr; at bottom). As far as I know, there is no blanket way to just filter out processes with a certain PID from ftrace as easily as it is to tell it to...
filter out certain processes and/or pids in ftrace?
1,406,268,808,000
I want to be able to run a command which would print what exactly FAT version/subtype is a partition formatted in (FAT12/FAT16/FAT32/VFAT/exFAT) Some guys suggests following command # stat -f -c %T /boot/efi msdos or # df -T | grep boot /dev/sda2 vfat 262144 67916 194228 26% /boot/efi here is wha...
vfat is only to represent that it's a FAT partition, according to the partition table and fstab. fdisk -l will tell you the same thing as df -T or mount. I wouldn't use stat, I would use file /dev/sda2 or parted /dev/sda -l to get a better idea. Side note: fuseblk is used for auto-mounted media. There is a clear dif...
How to determine file system type reliably under Linux?
1,406,268,808,000
I am using Centos 6.6 (x86_64) Trying to install most stable mongodb version available. but I am stuck with this error (which might seem repeated but none of the previous answers worked for me) [root@localhost home]# sudo yum install -y mongodb-org Loaded plugins: fastestmirror, refresh-packagekit, security Setting up...
The error is pretty clear from yum: http://repo.mongodb.org/yum/redhat/%24releaserver/mongodb-org/3.0/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found" There isn't a file at the other end of that URL for yum to download, hence the 404. Put that URL in your bro...
Yum error while installing MongoDB on CentOS?
1,406,268,808,000
This question answers to the question on how to find the what is part of cache. However, in the fincore executable you have to pass the filename to check if it is part of cache. Is there a tools or a method to find all the entries that are part of the cached memory without passing the filenames. PS: We are running it ...
I don't know of any place where the kernel exposes the filenames associated with the blocks that it has cached. According to this answer https://stackoverflow.com/a/4941371 The best you could probably do even with a custom kernel module would be to get a list of inodes and devices. From there you would still likely...
List all files that are present in the cache
1,406,268,808,000
Is there a way to replace password lock screen in Linux (Mint Debian Edition) with a pin lock screen? Like the one found in Windows 8 for example. It's annoying/inconvenient to have to input 16 character-long passwords every time I lock my computer, and insecure to decrease the password length to a pin-friendly length...
You can do this via PAM configuration. For example, if you use XScreenSaver, you'd edit /etc/pam.d/xscreensaver and change the @include common-auth line. Rather than repeat all the details, I'll point you to my answer to Set sudo password differently from login one. The procedure is almost exactly the same, except tha...
Pin Lock Screen
1,406,268,808,000
I am currently using openSUSE 13.1 KDE. The big reason why I like openSUSE is YaST. YaST does so much and makes many parts of life easier. YaST not only graphically allows me to add/remove/manage repositories, and packages. It allows me to manage my firewall, kernel, services, groups, sudo and a lot more from a GU...
Why not to depend on YaST There is nothing that does what YaST does for non-SUSE distros. There are little tools here and there but nothing as comprehensive. It's a blessing and a curse. People that come to depend on YaST miss out on how things under the hood actually work. I would take the time to actually "learn" h...
Something like YaST for non SUSE distros
1,406,268,808,000
What I want to do is, to monitor a directory (not recursive, just one) for new files created and append those files to one single big file as they are being written. The number of files that are being written is huge, could reach as much as 50,000. By using inotifywait, I am monitoring the directory like: inotifywait ...
No need to post-process the output... use inotifywait options --format and --outfile If I run: inotifywait -m --format '%f' -e create /home/don/folder/ --outfile /home/don/output.file then open another tab, cd to ~/folder and run: time seq -w 00001 50000 | parallel touch {} real 1m44.841s user 3m22.042s sys ...
Inotifywait for large number of files in a directory
1,353,086,939,000
If I list /proc/<pid>/fd I see a number of entries for sockets. These entries have timestamps. At first I thought they were when the socket was created. But it doesn't always appear to be the case. What does this timestamp mean?
It looks like the entries in /proc/x/fd are instantiated the first time you access them (via a lstat(2) or any system call that has them involved), and that's where the time comes from.
Timestamp of socket in /proc/<pid>/fd
1,353,086,939,000
I have multiple users on a server. They upload and download their files through FTP. Sometimes some heavy transfer causes high load on the server. I am wondering, if there is any way to limit the ftp speed to avoid high load. Any help would be much appreciated.
I found a way to limit ftp speed: In the /etc/proftpd.conf insert this line: TransferRate RETR,STOR,APPE,STOU 2000 This will limit ftp speed to 2 megabyte per second. After changing the file you should restart the proftpd service: /etc/init.d/proftpd restart
How to limit ftp speed
1,353,086,939,000
extract from syslog: CRON[pid]: (user) CMD ( [ -x /usr/lib/php5/maxlifetime ] && [ -d /var/lib/php5 ] && find /var/lib/php5/ -depth -mindepth 1 -maxdepth 1 -type f -cmin +$(/usr/lib/php5/maxlifetime) ! - execdir fuser -s {} 2>/dev/null \; -delete) My CPU has been stuck at 99% for a few hours now, and I'm assuming it'...
Found the answer here: http://www.flynsarmy.com/2011/11/fuser-using-100-cpu-in-ubuntu-11-10/ in /etc/cron.d/php5 on Ubuntu 11.10: Replace 09,39 * * * * root [ -x /usr/lib/php5/maxlifetime ] &amp;&amp; [ -d /var/lib/php5 ] &amp;&amp; find /var/lib/php5/ -depth -mindepth 1 -maxdepth 1 -type f -cmin +$(/usr/lib...
CPU stuck at 99% for a few hours: figuring out logs
1,353,086,939,000
Here are the flags from /proc/cpuinfo: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts nopl xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pd...
From the information available at Wikipedia and Intel, I'd assume that yes. From the Wikipedia entry: PCLMULQDQ Performs a carry-less multiplication of two 64-bit integers which matches the flag you have.
Do I have PCLMUL instruction set support?
1,353,086,939,000
Sorry - I don't remember the exact name. I know there is mechanism to patch the kernel at runtime by loading modules without need of the reboot as long as the structures involved are not affected. It is used by servers for security patches and recently by Ubuntu & Fedora. What is the name of mechanism Is there any ho...
I think you are looking for Ksplice. I haven't really followed the technology so I'm not sure how freely available the how-to information is but they certainly have freely available support for some Fedora and Ubuntu versions.
Patching Linux kernel on-line (i.e. without rebooting)
1,353,086,939,000
I only have a single on-board sound card which is a Realtek ALC298 and I do not have any needs for advanced sound configurations. Just a working sound system to listen to youtube videos, watch movies etc... So far I've followed many online articles. To summarize all of which I've tried: Figure out if channel(s) are m...
Good news! A very smart Arch user by the name of ronincoder discovered a fix for the headphone jack. I worked with ronincoder to make a kernel patch [1] and our patch made it into the 5.7 kernel release! It was also applied to the 5.4 LTS kernel. I booted both 5.7.2 and 5.4.46 and the headphone jack audio is loud and ...
ALSA, PulseAudio and Intel HDA PCH with no sound
1,353,086,939,000
how to force "machinectl shell" or systemd-run to ask for password in terminal instead of dialog window? I can run a command as root using: machinectl shell --uid=root --setenv='DISPLAY=:1.0' --setenv=SHELL=/bin/bash .host /bin/bash -lc 'startxfce4' but it ask for the password using the dialog window I want to have ...
Run a command as another user to run something as another user we have different methods: machinectl: this create a separate session ssh: this create a separate session systemd-run: this do not create a separate session, but create a separated service unit that can be controlled too like the session. for example wh...
sudo equivalent in systemd
1,353,086,939,000
I've seen a few other questions where they show you how to connect to a network using bash, but I haven't seen anything where you connect to a captive portal network from the command line using Linux. Is there a way to do login in a captive portal without being in graphics mode/having a Window manager?
As the underlying layers /Os is not talking WISpr/not running a program to deal with captive portals, for connecting to a captive portal in the command line, you only need a browser or a script. One of the possible solutions is using lynx, a text mode browser. It will work in most captive portals, and will allow you ...
How use a captive portal when in text mode?
1,353,086,939,000
I have a OSX machine where sort runs GNU sort from coreutils 8.26 (installed from Homebrew), and a Linux machine where sort runs GNU sort from coreutils 8.25. On the Mac: mac$ echo -e "{1\n2" | sort 2 {1 While on Linux: linux$ echo -e "{1\n2" | sort {1 2 I'm aware that sort depends on the locale. I ran locale on the...
I did some digging on the same problem the other day, so let me share a technical answer. On macOS, /usr/share/locale/en_US.UTF-8/LC_COLLATE (or en_CA.UTF-8, same thing) is a symlink to /usr/share/locale/la_LN.US-ASCII/LC_COLLATE, which is generated from la_LN.US-ASCII.src with colldef. Here's the entirety of la_LN.U...
Why does Gnu sort sort differently on my OSX machine and Linux machine?
1,353,086,939,000
I know you can change a process niceness with setpriority or nice or renice. However, does Linux automatically adjust/change a process niceness without user input? I have a process for which I use setpriority in C, like so: setpriority(PRIO_PROCESS, 0, -1) When the process is running, I can see its niceness value is ...
To my knowledge, the Linux kernel does not change the niceness of a process, and I fail to see why it would since it doesn't have to to lower the priority of a process. The niceness is an information given to the kernel, telling it how nice that process is willing to be. The kernel scheduler is free to take this infor...
Does Linux Change a Process Niceness Automatically?
1,353,086,939,000
$ setserial /dev/ttyUSB0 -G Cannot get serial info: Inappropriate ioctl for device What does this error mean? stty works fine: $ stty -F /dev/ttyUSB0 speed 9600 baud; line = 0; eof = ^A; min = 1; time = 0; -brkint -icrnl -imaxbel -opost -onlcr -isig -icanon -iexten -echo -echoe -echok -echoctl -echoke
This means that the driver does not support the IOCTL that setserial is using: setserial gets the information via an ioctl() call. In case the driver for your device does not support TIOCGSERIAL, the "invalid argument" is returned. (Debian bug report) I think stty should be able to perform any configuration you nee...
setserial: Cannot get serial info: Inappropriate ioctl for device
1,353,086,939,000
Consider you've been informed about a bad sector like this: [48792.329933] Add. Sense: Unrecovered read error - auto reallocate failed [48792.329936] sd 0:0:0:0: [sda] CDB: [48792.329938] Read(10): ... [48792.329949] end_request: I/O error, dev sda, sector 1545882485 [48792.329968] md/raid1:md126: sda: unrecoverable I...
The traditional way is to copy all files elsewhere and see which one triggers a read error. Of course, this does not answer the question at all if the error is hidden by the redundancy of the RAID layer. Apart from that I only know the manual approach. Which is way too bothersome to actually go through with, and if th...
How to find out which file is affected by a bad sector?
1,353,086,939,000
On Linux: Normally pseudo terminals are allocated one after the other. Today I realized that even after a reboot of my laptop the first opened terminal window (which was always pts/0 earlier) suddenly became pts/5. This was weird and made me curious. I wanted to find out which process is occupying the device /dev/...
If you have fuser installed and have the permission to use sudo: for i in $(sudo fuser /dev/pts/0); do ps -o pid= -o command= -p $i done eg: 24622 /usr/bin/python /usr/bin/terminator 24633 ksh93 -o vi
Which process is occupying a certain pseudo terminal pts/X?
1,353,086,939,000
I would like to know how I can run two ongoing processes at the same time in Linux/bash. basically, I have a Node web server, and a MJPG-Streamer server. I want to run both these processes at once, but they are ongoing processes. I heard about running them as background processes, but I want them to be the same prio...
When you say priority, you probably mean the nice-level of the process. To quote Wikipedia: nice is a program found on Unix and Unix-like operating systems such as Linux. It directly maps to a kernel call of the same name. nice is used to invoke a utility or shell script with a particular priority, thus giving ...
How do I run two ongoing processes at once in linux/bash?
1,353,086,939,000
I decided to encrypt my root partition with LUKS+LVM. My ThinkPad setup: Samsung 830 128GB SSD 750GB HDD Core 2 Duo 2,5 GHz P9500 8GB RAM But the more I read, the less I understand about those two following subjects: 1a. The cipher I was going to use SHA1 instead of 2/512 (as some suggest), because of that quote fro...
1a - it really doesn't matter all that much. which ever hash you use for the key derivation function, LUKS makes sure it will be computationally expensive. It will simply loop it until 1 second real time has passed. 1b - the key derivation method has no influence on performance. the cipher itself does. cryptsetup benc...
Trying to understand LUKS encryption
1,353,086,939,000
I want to block font substitution in specific apps on Linux, but my research indicates that it might be controlled only at the system level, probably with fontconfig. I have found some discussion of how to direct fontconfig to substitute particular fonts, but nothing on how to competely turn off the feature. The best ...
There appears to be absolutely no way to disable font fallback. If you have fontconfig installed, the font substitution mechanism will always be active. I have discovered two narrow ways to limit fallback. First, to block fallback in applications that use Pango, you can use the Pango fallback attribute to compile a sp...
How to block glyph fallback on Linux?
1,353,086,939,000
I don't know about the console font format, for a normal truetype font, I could use gnome-font-viewer to preview it, but what about console font? If I don't switch back to another tty, and use setfont command, is there a way to view it in X?
I don't think there's any widely-used tool. Try psfedit. There's also NAFE which lets you convert between console fonts and an ASCII pixel representation, or Cse to edit a font from the console. I haven't used any of these, so I'm not particularly recommending them, just mentioning their existence.
What tool can preview console font?
1,353,086,939,000
I am trying to achieve something similar to this: https://superuser.com/questions/67659/linux-share-keyboard-over-network The difference is that I need the remote keyboard to be usable separate from my local keyboard. The method described in the link seems to pipe the events into an existing device file. I need the re...
I found a project called netevent on GitHub which does exactly what I need. It makes local devices available to a remote computer. I was able to forward the mouse, but not the keyboard due to compatibility issues. Technically, this answers my question of how to share the keyboard over the network and have it appear as...
Share keyboard over network as separate device?
1,353,086,939,000
I am looking for a way to profile a single process including time spent for CPU, I/O, memory usage over time and optionally system calls. I already know callgrind offering some basic profiling features but only with debugging information and lacking most of the other mentioned information. I know strace -c providing a...
Meanwhile I wrote my own program - audria - capable of monitoring the resource usage of one or more processes, including current/average CPU usage, virtual memory usage, IO load and other information.
Detailed Per-Process Profiling
1,353,086,939,000
Is there an easy way in bash to flush out the standard input? I have a script that is commonly run, and at one point in the script read is used to get input from the user. The problem is that most users run this script by copying and pasting the command line from web-based documentation. They frequently include some...
This thread on nonblocking I/O in bash might help. It suggests using stty and dd. Or you could use the bash read builtin with the -t 0 option. # do your stuff # discard rest of input before exiting while read -t 0 notused; do read input echo "ignoring $input" done If you only want to do it if the user is at a ...
Bash flush standard input before a read
1,353,086,939,000
Sometimes you need to unmount a filesystem or detach a loop device but it is busy because of open file descriptors, perhaps because of a smb server process. To force the unmount, you can kill the offending process (or try kill -SIGTERM), but that would close the smb connection (even though some of the files it has ope...
Fiddling with a process with gdb is almost never safe though may be necessary if there's some emergency and the process needs to stay open and all the risks and code involved is understood. Most often I would simply terminate the process, though some cases may be different and could depend on the environment, who owns...
Safest way to force close a file descriptor
1,353,086,939,000
Netfilter connection tracking is designed to identify some packets as "RELATED" to a conntrack entry. I'm looking to find the full details of TCP and UDP conntrack entries, with respect to ICMP and ICMPv6 error packets. Specific to IPv6 firewalling, RFC 4890 clearly describes the ICMPv6 packets that shouldn't be dropp...
I don't know the answer, but you can find out yourself. Use these rules (creates an empty chain "NOOP" for accounting purposes): *filter ... :NOOP - [0:0] ... -A INPUT -i wanif -p icmpv6 --icmpv6-type destination-unreachable -j NOOP -A INPUT -i wanif -p icmpv6 --icmpv6-type packet-too-big -j NOOP -A INPUT -i wanif -p ...
netfilter TCP/UDP conntrack RELATED state with ICMP / ICMPv6
1,353,086,939,000
Why is this a binary multi-megabyte blob /etc/udev/hwdb.bin and why under /etc? Should I store it with etckeeper?
man hwdb: Hardware Database Files -- snipping unnecessary documentation details for this answer --- The content of all hwdb files is read by systemd-hwdb(8) and compiled to a binary database located at /etc/udev/hwdb.bin, or alternatively /usr/lib/udev/hwdb.bin if you want ship the compiled database in an immut...
Why is this a binary multi-megabyte blob `/etc/udev/hwdb.bin` under `/etc`?
1,353,086,939,000
I'm using mint 18.1 and searching a way to resize of opened window and center it by hotkey (resize to default value that set up). In cinnamon keyboard preferences I found in shortcuts a way to set window's position at center, but didn't find anything about set default window size (in other preferences sections). Is th...
Install Devilspie: sudo apt-get update && sudo apt-get install devilspie Devilspie is a non-gui utility that lets you make applications start in specified workplaces, in specified sizes and placements, minimized or maximized and much more based on simple config files. Create a Devilspie configuration directory for ...
cinnamon resize window to default size by hotkey
1,353,086,939,000
I'm currently using Debian Testing (stretch) after a hard drive crash on my laptop, but I'm facing a weird issue with it. The laptop (Acer 5830TG) has a non-removable three-cell 6000mAh Li-Ion battery, current capacity only 335mAh due to wear, which does not permit charging until battery voltage drops below 10.9 V. Pr...
Problem solved by myself, its UPower daemon, which is automatically started by dbus-daemon, as soon as I start any X session it starts automatically, but closing X session does not stop upower daemon. So logout X session and run sudo service upower stop and problem solved.
Undesired shutdown on low battery - Debian Testing
1,353,086,939,000
I am trying to forward all outgoing traffic from port 80 to port 8080 using iptables and I tried the following rule, though it did not work: iptables -t nat -A OUTPUT -p tcp --dport 80 -j REDIRECT --to-port 8080 Also, for incoming traffic I need a rule that forward port on the same host not to be as proxy.
You will need that under nat e.g *nat :PREROUTING ACCEPT :POSTROUTING ACCEPT :OUTPUT ACCEPT -A PREROUTING -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 8080 you can run this: with example of forwarding 80 to 8080 and so on... Incoming on 80 to 8080 iptables -t nat -A PREROUTING -p tcp -m tcp --dport 80 -j REDIRE...
forward outgoing traffic port using iptables
1,353,086,939,000
I have DVB-T USB dongle plugged into my Linux server (GUI-less). It works correctly, but I want to stream TV programs from server to my PC. For this I use Kaffeine that way: ssh -X -p 666 -i /home/maciek/.ssh/id_rsa media@media env LANG=pl_PL.UTF-8 /usr/bin/kaffeine As You can see, ssh works on port 666 and starts ka...
X11 has two neat aspects: it's a de facto standard for display on Linux, and it's network-transparent. There is unfortunately no such thing for sound. There are sound servers which do exactly what you want; unlike X which works out of the box, sound servers tend to require a little setup. JACK and Pulseaudio are the t...
Ssh audio redirection
1,353,086,939,000
I have 1 BlueTooth adapter on my laptop. Using the command line, I want to be able to enable / disable it. This would be the same functionality that is achieved using GUI -> Bluetooth settings -> Bluetooth ON | OFF.
sudo rfkill unblock bluetooth However, it seems to timeout sporadically. So needs some work...
Using Command Line (Linux) how do I enable the Bluetooth Adapter?
1,353,086,939,000
I use the following scp syntax in order to transfer a lot of files from Linux red-hat 5 to windows machine (under Temp directory). SSH server is already installed on windows machine. I use this line in my shell scripts: sshpass -p '$password' /usr/bin/scp -o StrictHostKeyChecking=no $FILE [email protected]:'D:/Temp'...
Hardware I wouldn't be that suspicious of scp. If it's working some of the time this sounds much more like a hardware issue with either your: network card (linux or windows host) wiring switch/router I would perform some benchmarking to eliminate these items first. You can see these U&L Q&A's for starters: How To ...
scp stuck when trying to copy files from Linux to windows
1,367,304,176,000
I recently came across a Linux feature I have never seen before, where pressing the PrntScr button on the keyboard prints a physical piece of paper with the contents of my console. I really need to find out how to disable this. It is driving me crazy. I followed a guide on creating a custom keymap, and I tried remappi...
You should be able to disable PrntScr on the console with a custom keymap. On archlinux the procedure is as follows (it should be similar for other distros): cd /usr/share/kbd/keymaps/i386/qwerty copy your default keymap to a new file: cp us.map.gz personal.map.gz gunzip the new map file: gunzip personal.map.gz edit...
Fully Disable PrntScr Key
1,367,304,176,000
I have a 4 port bridge: root@Linux-Switch:~# brctl show bridge name bridge id STP enabled interfaces br0 8000.000024cd2cb0 no eth0 eth1 eth2 eth3 My goal is to limit the upload speed of the eth2 interface. (eth0 is th...
I figured it out- I had to specify a 'protocol' in the filter. I could find much documentation on this- all the examples I could find specified the protocol as 'ip' but since this a switch, I thought I'd try 'all' and it worked! tc qdisc add dev eth0 root handle 1:0 htb default 2 tc class add dev eth0 parent 1:0 cla...
tc on bridge port
1,367,304,176,000
I have a new requirement to purge MySQL dump files that are older than 30 days. The files use a naming convention of "all-mysql-YYYYMMDD-HHMM.dump". The files are located on SAN mounted file system, so restoration is not an issue, but the drive space is limited unfortunately and fills up quickly so it requires frequen...
Another way to delete all except the last 30 files: rm $(ls -r | tail -n +31) Or here is a shorter version of the script in the original post: cd /opt/backup/mysql/dumps d=$(date -r $(($(date +%s)-30*86400)) +%Y%m%d) for f in all-mysql-*; do [[ ${f#all-mysql-} < $d ]] && rm $f done
Cleaner way to delete files on Linux which include a datestamp as part of file name
1,367,304,176,000
I'm trying to make udev stop mounting one of my devices at boot time, and I've created a rule in /etc/udev/rules.d/ called 1-myblacklist.rules. All the rule does is matches the device by kernel identifier (ie. sdb) and and set the attribute OPTION to "ignore_device" udevadm test /sys/block/sdb Shows that the my rule...
I just wanted to post the solution to this problem, in-case somebody else is faced with a similar challenge. Adding the following rules file did the trick: /etc/udev/rules.d/90-hide-partitions.rules KERNEL=="sda2",ENV{UDISKS_PRESENTATION_HIDE}="1" KERNEL=="sda3",ENV{UDISKS_PRESENTATION_HIDE}="1"
Making udev ignore certain devices during boot
1,367,304,176,000
Is there any way of configuring keyboard shortcuts in the Linux virtual console? For example, if I go to tty1 then press the key combination Ctrl+Alt+H, I would like the script /usr/bin/hello.sh to be executed. Ideally, the shortcut would be available even before logging in (in which case it would be executed with th...
Partial answer (because it's just an outline, and untested): Write a demon which listens to whatever /dev/input device corresponds to your main keyboard (there are symlinks, look at them). Start that demon as the user you specify, using whatever init system you have (systemd, sysv, whatever). The demon processes key ...
Keyboard shortcuts in the virtual terminal
1,367,304,176,000
To enable a serial console on Linux, one uses getty (most usually, its variant agetty). This binary takes as argument, among other, the value to initialize the TERM variable with. On Debian, with Sys V init, the default was vt100. With systemd, the default used to be vt102, and nowadays it's vt220. After playing a bit...
The TERM setting tells the application program what capabilities the terminal it is communicating with has, and how to utilize these capabilities (typically via a library like ncurses). In plain English: it tells what control sequences (escape sequences) it should send to move the cursor arount the screen, to change t...
Suitables TERM variable values for a serial console
1,367,304,176,000
I've learned that the firmware-subsystem uses udevd to copy a firmware to the created sysfs 'data' entry. But how does this work in case of a built-in driver module where udevd hasn't started yet? I'am using a 3.14 Kernel. TIA!
I read through the kernel sources, especially drivers/base/firmware_class.c, and discovered that CONFIG_FW_LOADER_USER_HELPER would activate the udev firmware loading variant (obviously only usable for loadable modules when udev is running). But as mentioned on LKML this seems to be an obsolete method. Furthermore ...
How does linux load firmeware for built-in driver modules [duplicate]
1,367,304,176,000
Without programs open, my computer uses about 512M of memory. Yesterday, I had nothing open, yet 2 GB of mem use (used - cache = 2153): total used free shared buffers cached Mem: 3261 2875 386 30 199 523 -/+ buffers/cache: 2153 ...
Writing a 1 to drop_caches only drops the ( data ) cache. The 3 also drops the dentry cache, or cache of names of files on the disk. If you had recently been working with directories containing many small files, that would account for it.
What memory is not used by processes and freed by `echo 3 > /proc/sys/vm/drop_caches`?
1,367,304,176,000
What I am looking for is a free and open source solution. If the distro I use matters, it is Open SUSE. VLC supports only WMV1&2.
Look up DLNA. I don't know what packages on OpenSUSE would provide it, but it's your best bet. Under Ubuntu, DLNA is provided by the package Rygel (although there is a plug in for Rhythmbox called Coherence).
How can I setup Apache on Linux to stream WMV-HD to Xbox 360?
1,367,304,176,000
Today I tried to install Linux Mint to test my programs on it. When I run Linux Mint from my .iso file I get this: So I don't know what should I do. My pc has Intel Core I3 x64, Radeon r7 240 and it works fine with everything. Linux Mint 18.3 cinnamon-32bit
Seems like window resizing bug, I just reloaded it and made the window full sized.
Linux Mint corrupted display, on first run in VirtualBox [closed]
1,367,304,176,000
I'm working on a software that builds Pacman packages (which basically are tarballs with some special metadata files). The test suite builds some packages, then compares the resulting package to a recorded expected result. One of the fields in the metadata recorded in the package is the installed size of the package, ...
Well, I've been prompted to put this as an answer by @derobert The problem you have is AUFS.... check the problems associated with it, check the reasons it's not in the latest kernels, check it's "stability", check it's "POSIX completeness". – Hvisage Jan 24 at 20:55
Why is `du --apparent-size` sometimes off by more than 90%?
1,367,304,176,000
I have used GNU/Linux on systems from 4 MB RAM to 512 GB RAM. When they start swapping, most of the time you can still log in and kill off the offending process - you just have to be 100-1000 times more patient. On my new 32 GB system that has changed: It blocks when it starts swapping. Sometimes with full disk activi...
The problem disappeared after upgrading to: Linux aspire 3.16.0-31-lowlatency #43~14.04.1-Ubuntu SMP PREEMPT Tue Mar 10 20:41:36 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux It is not given that it was this kernel upgrade, that fixed it.
GNU/Linux swapping blocks system
1,365,539,480,000
I am using Fedora 16 in my DELL n4110. I recently upgraded the kernel from 3.2 to 3.3. In contradiction to the official claim, my system still drains battery as hell. It only provides 1:30 to 2 hrs of backup under normal stress as before, where as Windows provides 3hrs/+ of backup under similar stress. Below are some ...
The problem is gone with new versions of linux kernel :). I have not seen power regression since ubuntu 14.
Linux kernel 3.3 power regression
1,365,539,480,000
The status of UBIFS in Linux on top of MLC NAND has never been exactly perfect. And while this entry has now been removed from the FAQ nowadays, the support for UBIFS on top of MLC NAND has now been officially reported as unsupported: ubi: Reject MLC NAND Full thread on patchwork.kernel.org: https://patchwork.kerne...
So it seems that two options are possible: git revert b5094b7f135be and then, wait for more work on MLC+NAND The fact that MLC NANDs are not supported by UBI is not necessarily definitive. I have a branch with all the work we've done to add MLC support to UBI 2. If you have time to invest in it, feel free to t...
Linux: Alternative to UBIFS on MLC NAND
1,365,539,480,000
I have a directory on my Debian system. The directory is: root@debian:/3/20150626# stat 00 File: `00' Size: 6 Blocks: 0 IO Block: 4096 directory Device: fe00h/65024d Inode: 4392587948 Links: 3 Access: (0755/drwxr-xr-x) Uid: ( 0/ root) Gid: ( 0/ root) Access: 2015-06-25 20:00:...
Found the answer. Something was wrong with the linkage, as @JeffSchaller suggested. The solution is to run xfs_check to see that the links were incorrect, then xfs_repair to fix them. run mount to view the device name. Mine is /dev/mapper/vg3-lv3 umount /3 xfs_check /dev/mapper/vg3-lv3 which returned the following...
sudo rm -rf returns "cannot remove directory" on empty directory owned by root
1,365,539,480,000
I am connected with SSH to a machine on which I don't have root access. To install something I uploaded libraries from my machine and put them in the ~/lib directory of the remote host. Now, for almost any command I run, I get the error below (example is for ls) or a Segmentation fault (core dumped) message. ls: reloc...
Since you can log in, nothing major is broken; presumably your shell’s startup scripts add ~/lib to LD_LIBRARY_PATH, and that, along with the bad libraries in ~/lib, is what causes the issues you’re seeing. To fix this, run unset LD_LIBRARY_PATH This will allow you to run rm, vim etc. to remove the troublesome librar...
Almost no commands working - relocation error: symbol __getrlimit, version GLIBC_PRIVATE not defined in libc.so.6
1,365,539,480,000
Is it possible for ping command in Linux(CentOS) to send 0 bytes. In windows one can define using -l argument command tried ping localhost -s 0 PING localhost (127.0.0.1) 0(28) bytes of data. 8 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 8 bytes from localhost (127.0.0.1): icmp_seq=2 ttl=64 ^...
A ping cannot be 0 bytes on Linux, Windows or any other platform that claims to be able to send pings. At the very least the packet must contain an IP header and a non-malformed no-trick-playing ping will also include an ICMP header, which is 8 bytes long. It is possible that windows differs in how they output the ...
ping to send 0 bytes
1,365,539,480,000
Say I want execute cmd on all *.cpp and *.hpp files that contain the word FOO. As far as just finding those files goes, I know I can do, find /path/to/dir -name '*.[hc]pp' -exec grep -l 'FOO' {} + but what is the proper way to extend the processing so that I can execute, say cmd on each of those files? I know I could...
-exec … \; is also a test, it succeeds iff the command inside returns exit status 0. -exec … + can process many pathnames with one command and it always succeeds, so it's not a useful test. grep -q plays nicely with -exec … \; because it returns exit status 0 when there is a match (even if an error was detected), 1 ot...
How to execute a command on all files whose names match a pattern and whose contents match a pattern?
1,365,539,480,000
I am customizing a Linux system with a kernel of 6.4.0, and I have noticed a strange issue. When I execute top > a.txt and then open a window to execute cat a.txt, I find that the cat a.txt result is the result of multiple top attempts, but I wouldn't have this problem with other Linux systems. In other Linux systems,...
Some top implementation (e.g. on OpenBSD, but presumably on some Linux systems too) detects whether its output is going to the terminal or to something that isn't a terminal (to a pipe or to a file) and changes its behaviour depending on this. If the output goes to a terminal, the utility will be in interactive mode,...
When redirecting top to a file, why does cat command on that file display output of multiple top attempts?
1,365,539,480,000
I know that i can use nmap to see which ports are open on specific machine. But what i need is a way to get it from the host side itself. Currently, if i use nmap on one of my machines to check the other one, i get for an example: smb:~# nmap 192.168.1.4 PORT STATE SERVICE 25/tcp open smtp 80/tcp open http ...
On Linux, you can use: ss -ltu or netstat -ltu To list the listening TCP and UDP ports. Add the -n option (for either ss or netstat) if you want to disable the translation from port number and IP address to service and host name. Add the -p option to see the processes (if any, some ports may be bound by the kernel ...
A way to find open ports on a host machine
1,365,539,480,000
I'm using Debian 8. How do I get my external IP address from a command line? I thought the below command would do the job ... myuser@myserver:~ $ /sbin/ifconfig $1 | grep "inet\|inet6" | awk -F' ' '{print $2}' | awk '{print $1}' addr:192.168.0.114 addr: addr:127.0.0.1 addr: but as you can see, it is only revealing...
You mean whatever routable IP your dsl/cable modem/etc. router has? You need to either query that device OR ask an outside server what IP it sees when you connect to it. The easiest way of doing that is to search google for "what is my ip" and like the calculation searches, it will tell you in the first search result...
How do I get my IP address from the command line? [duplicate]
1,365,539,480,000
I tried doing ls [a-z][a-z], but it doesn't seem to be working.
With bash, set the glob settings so that missing matches don't trigger an error: shopt -u failglob # avoid failure report (and discarding the whole line). shopt -s nullglob # remove (erase) non-matching globs. ls ?c c? Question-mark is a glob character representing a single character. Since you want two-character f...
How do I display file names that contain two characters and one of them is c?
1,365,539,480,000
$ sudo su # dd if=/dev/zero of=./myext.img bs=1024 count=100 . . . # modprobe loop # losetup --find --show myext.img /dev/loop0 # mkfs -t myext /dev/loop0 . . . # mkdir mnt # mount /dev/loop0 ./mnt # cd mnt # ls -al total 17 drwxr-xr-x 3 root root 1024 Jul 21 02:22 . drwxr-xr-x 11 shisui shisui 4096 Jul 21 02:22 ....
You don’t see mnt in the ls -al output because you’re inside mnt; it is represented by . There’s another hard link to ., lost+found/..; this explains the count of 3 links to the directory: . which points to the directory itself; .. which also points to the directory, because it’s the root directory in the file system...
Why does this new directory have a link count of 3?
1,365,539,480,000
There is a way to visualize multiple terminals at the same time without running a Xorg session ? I have a really low profile machine that could be great for some basic stuff but has an horrible support for the GPU in terms of drivers and computing power.
Check out tmux and/or screen. A comparison of the two programs which satisfy essentially the same needs can be found on the tmux FAQ. A very good blog post for getting started with tmux is at Hawk Host: TMUX the terminal multiplexer part 1 and part 2. If you want to know more about tmux's versatility, there's a nice b...
Multiple terminals at once without an X server
1,365,539,480,000
We have so many options for window managers, shells, desktop environments, distros, and kernel architectures under Linux, but why after (maybe) 20 years do we only have X.org server (including its predecessor) as the bottom layer of GUI? I know about XFree86, and Y, but most of them are stuck. Is it so hard to create...
There are several other implementations of X11, but none of them have all the features & driver support that X.org has. There are also some framebuffer-based solutions like DirectFB and whatever Android uses. And recently work has been ongoing on Project Wayland, which maybe one day might (partially) replace X11.
linux x.org alternative
1,365,539,480,000
How can I execute a command only if a certain file exceeds a defined size? Both should at the end run as a oneliner in crontab. Pseudocode: * * * * * find /cache/myfile.csv -size +5G && echo "file is > 5GB"
To use the file size as a precondition you can use stat or find: [ -n "$(find /cache/myfile.csv -prune -size +5G 2>/dev/null)" ] && echo "file is > 5GB" Or if the target command (echo, here) is short, put it into the exec part of `find find /cache/myfile.csv -prune -size +5G -exec echo "file is > 5GB" \; The -prune ...
How to run a command only if a specific file has a certain size
1,365,539,480,000
What steps do you take to make a vanilla Ubuntu system run faster and use less memory? I'm using Ubuntu as the OS for my general purpose PC, but it's on slightly older hardware and I want to get as much out of it as I can. Short of leaner distros, what things do you do to make it run a bit faster for basic web brows...
Many Distributions offer what is called a Just Enough Operating System, or JeOS. How you go about installing these varies from distro to distro. Under Debian based distributions, such as Ubuntu, if you use a Server Install ISO, you can install the JeOS by pressing F4 on the first menu screen to pick "Minimal installa...
How do you free up resources in Ubuntu?
1,365,539,480,000
I need to enable the case insensitive filesystem feature (casefold) on ext4 of a Debian 11 server with a backported 6.1 linux kernel with the required options compiled in. The server has a swap partition of 2GB and a big ext4 partition for the filesystem, which it also boots from. I only have ssh access as root and ca...
I like your approach; it's clean in that it doesn't require modification of the data on your main system. And, yes, I think that if you want to run tune2fs then by a large margin, the easiest solution is to run that from a running Linux, so that there's no real way around having to run it when the main file system isn...
How to change the casefold ext4 filesystem option of the root partition, if I only have ssh access
1,365,539,480,000
After installing PyCharm on Pop! OS (by extracting the download) there is no easy way to run the program. I have probably installed it in my Documents folder. Not sure what the convention is. To run PyCharm I need to go to the folder pycharm-community-2019.2.4/bin, open terminal and run ./pycharm.sh Any way to make m...
You can use main menu. There is Tools -> Create Desktop Entry. It might require root permissions.
PyCharm has no shortcut or launcher
1,365,539,480,000
Both hier(7) and file-hierarchy(7) man pages claim to describe the conventional file system hierarchy. However, there are some differences between them. For example, hier(7) describes /opt and /var/crash, but file-hierarchy(7) does not. What are the differences between these two descriptions. Which one do real Linux s...
The hier manual page has a long history that dates back to Unix Seventh Edition in 1979. The one in Linux operating systems is not the original Unix one, but a clone. At the turn of the century, FreeBSD people documented existing long-standing practice, namely that system administrators adjust stuff for their own sys...
What's the difference between 'hier(7)' and 'file-hierarchy(7)' man pages?
1,365,539,480,000
sudo su - will elevate any user(sudoer) with root privilege. su - anotheruser will switch to user environment of the target user, with target user privileges What does sudo su - username mean?
Just repeating both @dr01 and @OneK's answers because they are both missing some fine details: su - username - Asks the system to start a new login session for the specified user. The system will require the password for the user "username" (even if its the same as the current user). sudo su - username will do the sa...
su - user Vs sudo su - user
1,365,539,480,000
This syntax prints "linux" when variable equals "no": [[ $LINUX_CONF = no ]] && echo "linux" How would I use regular expressions (or similar) in order to make the comparison case insensitive?
Standard sh No need to use that ksh-style [[...]] command, you can use the standard sh case construct here: case $LINUX_CONF in ([Nn][Oo]) echo linux;; (*) echo not linux;; esac Or naming each possible case individually: case $LINUX_CONF in (No | nO | NO | no) echo linux;; (*) echo not ...
bash - case-insensitive matching of variable
1,365,539,480,000
I have a CSV file like a.csv "1,2,3,4,9" "1,2,3,6,24" "1,2,6,8,28" "1,2,4,6,30" I want something like b.csv 1,2,3,4,9 1,2,3,6,24 1,2,6,8,28 1,2,4,6,30 I tried awk '{split($0,a,"\""); But did not help.Any help is appreciated.
Use gsub() function for global substitution $ awk '{gsub(/"/,"")};1' input.csv 1,2,3,4,9 1,2,3,6,24 1,2,6,8,28 1,2,4,6,30 To send output to new file use > shell operator: awk '{gsub(/"/,"")};1' input.csv > output.csv Your splitting to array approach also can be used, although it's not necessary, ...
how to remove the double quotes in a csv [duplicate]
1,365,539,480,000
Some of my jobs are getting killed by the os for some reason. I need to investigate why this is happening. The jobs that I run don't show any error messages in their own logs, which probably indicates os killed them. Nobody else has access to the server. I'm aware of OOM killer, are there any other process killer...
oom is currently the only thing that kills automatically. dmesg and /var/log/messages should show oom kills. If the process can handle that signal, it could log at least the kill. Normally memory hogs get killed. Perhaps more swap space can help you, if the memory is only getting allocated but is not really needed. ...
what process killers does linux have? [closed]
1,365,539,480,000
I want to list all the physical volume associated with logical volume. I know lvdisplay, pvscan, pvdisplay -m could do the job. but I don't want to use these commands. Is there any other way to do it without using lvm2 package commands? Any thoughts on comparing the major and minor numbers of devices?
There are two possibilities: If you accept dmsetup as a non-lvm package command (at openSUSE the is a separate package device-mapper) then you can do this: dmsetup table "${vg_name}-${lv_name}" Or you do this: start cmd: # ls -l /dev/mapper/linux-rootfs lrwxrwxrwx 1 root root 7 27. Jun 21:34 /dev/mapper/linux-rootfs...
list the devices associated with logical volumes without using lvm2 package commands
1,365,539,480,000
On my Linux machine, it isn't clear to me why if I do the following then I don't get only the version string ("1.5.0_32"). # java -version | grep version | awk '{print $NF}' java version "1.5.0_32" Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_32-b05) Java HotSpot(TM) Server VM (build 1.5.0_32-b05, mix...
Try like this: java -version 2>&1 | grep version | awk '{print $NF}' Looks like the output is going to stderr. Also, grep is not needed: java -version 2>&1 | awk '/version/{print $NF}'
Output of `java -version` not matched by grep or awk
1,365,539,480,000
Given a zip file zipfile.zip, we know that it contains a file called text.txt. Is there a way to read the content of text.txt without unzipping zipfile.zip?
You can dump the file directly to stdout, for example. You are still technically unzipping it, but not to disk: $ unzip -p zipfile.zip text.txt For example, to count the lines you could do this: $ unzip -p zipfile.zip text.txt | wc -l The -c option is similar, but will write the name of each extracted file right bef...
Read file content in a zip file without unzipping?
1,554,251,819,000
I would like use a program like tail to follow a file as it's being written to, but not display the most recent lines. For instance, when following a new file, no text will be displayed while the file is less than 30 lines. After more than 30 lines are written to the file, lines will be written to the screen starting...
Maybe buffer with awk: tail -n +0 -f some/file | awk '{b[NR] = $0} NR > 30 {print b[NR-30]; delete b[NR-30]} END {for (i = NR - 29; i <= NR; i++) print b[i]}' The awk code, expanded: { b[NR] = $0 # save the current line in a buffer array } NR > 30 { # once we have more than 30 lines print b[NR-30]; # print th...
Using "tail" to follow a file without displaying the most recent lines
1,554,251,819,000
Is there a way to know which partition you actually booted from? fdisk -l reveals a "Boot" column that I definitely don't have on my NVME. Is this just legacy information? Device Boot Start End Sectors Size Id Type /dev/sda1 * 2048 1126399 1124352 549M b W95 FAT32 /dev/sda2 11...
Since your system apparently boots in UEFI style, the answer to the titular question is: Run efibootmgr -v as root, see the four-digit ID on the BootCurrent: line (usually the first line of output), then look at the corresponding BootNNNN line to find both the PARTUUID of the partition to boot from, and the filename c...
How do I tell which partition I booted from?
1,554,251,819,000
This GRUB Quiet Splash says: The splash (which eventually ends up in your /boot/grub/grub.cfg ) causes the splash screen to be shown. At the same time you want the boot process to be quiet, as otherwise all kinds of messages would disrupt that splash screen. Although specified in GRUB these are kernel parameters infl...
If you specify a boot option that the kernel does not recognize, it does not cause an error: the unknown boot parameter will have no effect to the kernel, other than being listed in /proc/cmdline. Then initramfs scripts or other userspace programs can look for it and use it to modify their behavior. The unknown boot p...
Why splash is not in kernel parameters list but works?
1,554,251,819,000
I'm constantly having the situation where I want to correlate the output of lsblk which prints devices in a tree with their name in the scheme of /dev/sdXY with the drives /dev/disk/by-id/ names.
The by-id names consists of the drive model together with the serial something which lsblk can be instructed to list: lsblk -o name,model,serial The output of this command will look something like this: NAME MODEL SERIAL sda SAMSUNG HD203WI S1UYJ1VZ500792 ├─sda1...
Make lsblk list devices by-id
1,554,251,819,000
I am working on Linux Ubuntu, and I want a bash script whose output is to convert the timezone 7 hours in advance from my server time. My server time: Mon Jul 23 23:00:00 2017 What I want to achieve: Mon Jul 24 06:00:00 2017 I have tried this one in my bash script: #!/bin/bash let var=$(date +%H)*3600+$(date +%M...
Taking your question literally, if you just want to get a date string for 7 hours later than the current time in the current zone, that's easy: date -d "7 hours" "+%Y-%m-%d %H:%M:%S" If what you're really wanting to do is pull the local date/time in some other timezone, though, then you'd be better off following the ...
How to change time zone in a bash script?
1,554,251,819,000
I've added myself into the sudoers users list by using the command root@debian:/home/oshirowanen#adduser oshirowanen sudo If I try to run that command again, root@debian:/home/oshirowanen# adduser oshirowanen sudo The user `oshirowanen' is already a member of `sudo'. root@debian:/home/oshirowanen# All looks good s...
You need to log in again after adding yourself to a group to get the correct privileges. To verify with two shells: alice $ sudo adduser test alice $ su - test alice $ sudo adduser test sudo test $ sudo ls test is not in th...
How to add self to sudoers list?
1,554,251,819,000
I am on a closed network (i.e. no connectivity to the internet). I have a bourne shell script that asks for the user to enter a regular expression for use with grep -P. Generally speaking, I like to do some form of input validation. Is there a way to test a string variable to see if it is a (valid) regex? (Copying thi...
No, but with some tools it's not hard to test whether a regex compiles or not. For example, with grep: echo | grep -P '[' - the exit code, $?, will be 2, indicating an error occurred (and for this example, grep will print "grep: missing terminating ] for character class" to stderr - you can redirect stderr to /dev/nul...
Does Bourne Shell have a regex validator?
1,554,251,819,000
I would like to check whether a Linux machine supports io_uring. How can this be done? Is there some kernel file that describes support for this, or do all Linux 5.1+ kernels have support?
io_uring doesn’t expose any user-visible features, e.g. as a sysctl; it only exposes new system calls. It is available since kernel 5.1, but support for it can be compiled out, and it might be backported to older kernels in some systems. The safest way to check for support is therefore to check whether the io_uring sy...
How to tell if a Linux machine supports io_uring?
1,554,251,819,000
I have this output. [root@linux ~]# cat /tmp/file.txt virt-top time 11:25:14 Host foo.example.com x86_64 32/32CPU 1200MHz 65501MB ID S RDRQ WRRQ RXBY TXBY %CPU %MEM TIME NAME 1 R 0 0 0 0 0.0 0.0 96:02:53 instance-0000036f 2 R 0 0 0 0 0.0 0.0 95:44:07 instance-00000372 vi...
This feels a bit silly, but: $ tac file.txt |sed -e '/^virt-top/q' |tac virt-top time 11:25:17 Host foo.example.com x86_64 32/32CPU 1200MHz 65501MB ID S RDRQ WRRQ RXBY TXBY %CPU %MEM TIME NAME 1 R 0 0 0 0 0.6 12.0 96:02:53 instance-0000036f 2 R 0 0 0 0 0.2 12.0 95:44:08 ins...
extract lines from bottom until regex match
1,554,251,819,000
Ex: Input file A<0> A<1> A_D2<2> A_D2<3> A<4> A_D2<6> A<9> A_D2<10> A<13> Desired Output: A<0> A<1> A_D2<2> A_D2<3> A<4> ----- A_D2<6> ----- ----- A<9> A_D2<10> ----- ----- A<13> Just care about the number in the angle bracket. If the number is not continuous ,then add some symbol (or just add newline) until the num...
Using grep or sed for doing this would not be recommended as grep can't count and sed is really difficult to do any kind of arithmetics in (it would have to be regular expression-based counting, a non-starter for most people except for the dedicated). $ awk -F '[<>]' '{ while ($2 >= ++nr) print "---"; print }' file A<...
How to add some symbol (or just add newline) if the numbers in the text are not continuous
1,554,251,819,000
Do all different Linux distributions have the same command lines? What I want to know is the same command line works for all kinds of Linux distributions (CentOS, Fedora, Ubuntu, etc.) or whether they all have different command lines?
I'm choosing to interpret this question as a question about the portability of commands and shells across various Linux distributions. A "command line" could mean both "a command written at the shell prompt" and "the shell itself". Hopefully this answer addresses both these interpretations of "command line". Most U...
Do all different Linux distributions have the same command lines? [closed]
1,554,251,819,000
I have a file of genomic data that is approximately 5 million lines long and should have only the characters A, T, C, and G in it. The problem is, I know how large the file should be, but it's slightly larger than that. Which means, something went wrong in an analysis, or there are lines that contain something other t...
First of all, you definitely do not want to open the file in an editor (it's much too large to edit that way). Instead, if you just want to identify whether the file contains anything other than A, T, C and G, you may do that with grep '[^ATCG]' filename This would return all lines that contain anything other than t...
Find any line in VI that has something other than ATCG
1,554,251,819,000
I there a way to split single line into multiple lines with 3 columns. New line characters are missing at the end of all the lines in the file. I tried using awk, but it is splitting each column as one row instead of 3 columns in each row. awk '{ gsub(",", "\n") } 6' filename where filename's content looks like: A,B...
Using awk $ awk -v RS='[,\n]' '{a=$0;getline b; getline c; print a,b,c}' OFS=, filename A,B,C D,E,F G,H,I J,K,L M,N,O How it works -v RS='[,\n]' This tells awk to use any occurrence of either a comma or a newline as a record separator. a=$0; getline b; getline c This tells awk to save the current line in variable a,...
Split single line into multiple lines, Newline character missing for all the lines in input file [duplicate]
1,554,251,819,000
I saw many place introduce screen to run background job stably even log out. They use screen -dmS name According to screen -h, this option means -dmS name Start as daemon: Screen session in detached mode. What is daemon? I don't understand. I found that if I simply type screen, I can enter automatically into a ...
You would only use -dm if you want to run a command in a screen session and not enter it interactively -S is just to give the session a usable name so you can reconnect to it again easily later If you want to use it interactively and don't want to give it a human readable name, you can omit all of those arguments safe...
Do I really need -dmS option in screen to run background job stably even log out?
1,554,251,819,000
initramfs archives on Linux can consist of a series of concatenated, gzipped cpio files. Given such an archive, how can one extract all the embedded archives, as opposed to only the first one? The following is an example of a pattern which, while it appears to have potential to work, extracts only the first archive: w...
Debian with the packages amd64-microcode / intel-microcode packages installed seems to use some kind of mess of an uncompressed cpio archive containing the CPU microcode followed by a gzip compressed cpio archive with the actual initrd contents. The only way I've ever been able to extract it is by using binwalk (apt i...
Extracting concatenated cpio archives
1,554,251,819,000
I just compiled a new kernel and asked myself: What decides during the compilation process which kernel modules are built in the kernel statically? I then deleted /lib/modules, rebooted and found that my system works fine, so it appears all essential modules are statically built in the kernel. Without /lib/modules, th...
You do this as part of the configuration process, usually when you run make config, make menuconfig or similar. You can set the module as built-in (marked as *), or modularised (marked as M). You can see examples of this in a screenshot of make menuconfig, from here:
What decides which kernel modules are built in the kernel statically during compilation?