Tag Info

Hot answers tagged

20

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


18

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


15

A linux kernel should store an on-screen log for your vts in the corresponding /dev/vcsa*[ttynum] device. It is why the following works: echo hey >/dev/tty2 dd bs=10 count=1 </dev/vcs2 ...which prints... hey The corresponding /dev/vcsa[ttynum] device will store an encoded version of the formatted text on-screen, whereas the ...


10

You could also handle this with bash parameter expansion: s=swp-RedHat-Linux-OS-5.5.0.0-03 echo ${s%-*} ${s##*-} Output: swp-RedHat-Linux-OS-5.5.0.0 03


10

When is dd suitable for copying data? (or, when are read() and write() partial) points out an important caveat when using count: dd can copy partial blocks, so when given count it will stop after the given number of blocks, even if some of the blocks were incomplete. You may therefore end up with fewer than bs * count bytes copied, unless you specify ...


9

That command depends on the shell generating 5000 arguments, and passing them to printf which then ignores them. While it may seem pretty quick - and is relative to some things - the shell must still generate all of those strings as args (and delimit them) and so on. Besides the fact that the generated Hs can't be printed until the shell first iterates to ...


9

The command that you must use for you is: id and for any other user: id username


8

Something like this worked for me, although I'm sure there are better ways echo "swp-RedHat-Linux-OS-5.5.0.0-03" | rev | sed 's/-/ /' | rev swp-RedHat-Linux-OS-5.5.0.0 03


8

The dmesg command shows the current content of the kernel syslog ring buffer messages while the /var/log/dmesg file contains what was in that ring buffer when the boot process last completed.


7

I encountered this error before as well. A manual file system check fixes it, but you can consider some files lost already. Syntax: fsck -y It is best to do this in single user mode.


6

The %.0s means to convert the argument as a string, with a precision of zero. According to man 3 printf, the precision value in such a case gives [ ... ] the maximum number of characters to be printed from a string for s and S conversions. hence when the precision is zero, the string argument is not printed at all. However the H (which is part of ...


6

dup2 doesn't return void, it returns int, so you should check its return code. If dup2 were failing for some reason and that was the problem then you wouldn't know about it. That being said, dup2 normally always works. There is one corner case that could cause what you are seeing: if sockfd is already 0. Then you'd be dup2ing 0 to 0 and then closing 0, ...


6

The ssh user@ip is correct syntax. The other logs in to the host ip as you and tries to run a command called root. Please update your question with an explanation of what are you actually trying to achieve.


5

This looks like an NFS issue. Is NFS involved? NFS servers running on Debian-based systems, and possibly others, are configured to ignore supplementary groups unless told specifically otherwise. Ensure that --manage-gids has been supplied to the rpc.mountd program. On Debian systems that is done by editing /etc/default/nfs-kernel-server and ensuring that ...


5

one volume group solution pvcreate /dev/sdb vgextend vg0 /dev/sdb pvmove /dev/vg0/bar /dev/sda /dev/sdb two volume group solution pvcreate /dev/sdb vgcreate vg1 /dev/sdb lvcreate -l100%FREE vg1 mkfs -t ext4 /dev/vg1/lvol1 mount /dev/vg1/lvol1 /mnt now difficult part, all activities MUST stop on /bar cd /mnt ; ( cd /bat ; tar cf - * ) | tar xf ...


5

useradd only uses the same UID and GID when either: It won't cause a conflict; or You force it with the -u and -g flags It will skip over already-in-use IDs. So, I would guess that you have added other users and/or groups since you created those that have matching UID/GID pairs.ยน To get the IDs back in lock-step, you could create the next one with -g ...


5

I found the answer here The trick is to use the command timeout So the ideal way is timeout 2 df -kh , here 2 is the timeout in seconds.


5

The cron job you pasted will run at 1am daily, and the > /dev/null 2>&1 part ensures that its output is thrown away. Remove this bit if you intend to receive the script's output by e-mail. There is a chance that your job is running, but simply failing early (perhaps because the environment provided by cron lacks things provided by your testing ...


5

In the if condition give the $line in the double quotes it will work fine #!/bin/bash line="hello welcome " if [ -z "$line" ] ; then echo "String null" fi


4

You CPU is slow. A score of 760 for a dual core CPU is bad. If you take a look at the single-core performance for that CPU on the site it's on par with a good Pentium III. The GPU should be good enough for YouTube but together with the CPU it could be not enough. I can watch 760p YouTube in HTML5 on a Pentium M with a much slower AMD GPU. Be sure to have ...


4

To get the octal permission notation. stat -c "%a" file 644 See the manpage of stat, -c specifies the format and %a prints the permissions in octal. Or for multiple files and folders: stat -c "%a %n" * 755 dir 644 file1 600 file2


4

Changing the block size is a good way to change how much gets buffered or is read/written at a time. Doesn't really relate to whether it's a real block device or an infinite/virtual one. It's about how much you want stored in memory before dd goes to write it out. bs= sets both ibs= (how much data is read in at a time) and obs= (how much data is written ...


4

Because bash does it internally for you, expanded the filename and cats the file to standard output, like if you were to do $(cat < filename). It's a bash feature, maybe you need to look into the bash source code to know exactly how it works. Here the the function to handle this feature (From bash source code, file builtins/evalstring.c): /* Handle a $( ...


4

Just use an array. For example: ## read the MACs into an array declare -a Vmac=( $(wmic --delimiter="," --authentication-file=/path/to/file \ //IP-ADDR "Select AdapterType,MACAddress from Win32_NetworkAdapter" | grep "Ethernet" | awk -F, '{print $3}'| sort | uniq | tr '\n' ' ' ) ## Add NAs as appropriate for((i=0;i<6;i++)); do ...


4

First, edit /etc/default/grub and find the line: GRUB_CMDLINE_LINUX="" and change the line to say this instead (this will disable ipv6 completely): GRUB_CMDLINE_LINUX="ipv6.disable=1" alternatively, to leave the ipv6 stack functional but to disable assignment of ipv6 addresses you can use the following option instead: ...


4

seclabel is an indicator added by the selinux code, that the filesystem is using xattrs for labels and that it supports label changes by setting the xattrs. You shouldn't add seclabel on your own, it should normally be added by selinux automatically if it's enabled. I would try to find a way to ignore that nagios message if you don't need selinux.


4

I am sharing the answer, as how I resolved this issue. I edited the /etc/fstab and provided the root FS with FSCK=1, /dev/mapper/vg_vipin-lv_root / ext4 defaults 0 1 And then I did a reboot. fsck will be performed and now everything is back to normal.


4

If you have htop you can press Shift+k to toggle the display of kernel threads. If you press F5 for tree mode, they should all appear as children of kthreadd. There are some visible differences between a kernel thread and a user-space thread: /proc/$pid/cmdline is empty for kernel threads - this is the method used by ps and top to distinguish ...


4

You can change this behaviour if you edit secure tmp option in /lib/systemd/system/mariadb.service. systemctl stop mariadb next edit /lib/systemd/system/mariadb.service as you change PrivateTmp to false: # Place temp files in a secure directory, not /tmp PrivateTmp=false # default is true and finally: systemctl daemon-reload systemctl start mariadb ...


3

Why not only use what's on the disk ? You can. You do not have to use an initrd (or an initramfs, the newer and more widespread version since kernel 2.6.13). The reason that they are used is that distro kernels are generic and must support a wide range of hardware out of the box. Some of the drivers for different hardware, crucial to mounting a root ...



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