Tag Info

Hot answers tagged

21

Lemma: sl prints a steam locomotive Lemma: The steam locomotive contains forward slashes: $ touch ' ( ) (@@) ( ) (@) () @@ O @ O @ O > (@@@) > ( ) > (@@@@) > > ( ) > ==== ________ ...


17

You can check the source code here - https://github.com/mtoyoda/sl, alas there is no other options other than the ones documented and sadly nothing that will actually print the names of files. So it looks like @sfyn's answer is the correct one.


15

Here's a patch to fix that bug :) diff --git a/sl.c b/sl.c index 2eeceb3..f2213ad 100644 --- a/sl.c +++ b/sl.c @@ -37,6 +37,7 @@ #include <curses.h> #include <signal.h> #include <unistd.h> +#include <stdlib.h> #include "sl.h" int ACCIDENT = 0; @@ -71,6 +72,13 @@ void option(char *str) int main(int argc, char *argv[]) { ...


10

To get this information from sysfs for a device file, first determine the major/minor number by looking at the output of ls -l, eg $ ls -l /dev/sda brw-rw---- 1 root disk 8, 0 Apr 17 12:26 /dev/sda The 8, 0 tells us that major number is 8 and the minor is 0. The b at the start of the listing also tells us that it is a block device. Other devices may ...


9

Per @Kevin in the comments below, the --file - |pipe syntax is redundant. So I've removed it. This can also be done with tar: sudo tar -C${SRC_DIR} --remove-files --group=unicorn --owner=unicorn -c ./* | sudo tar -C${TGT_DIR} -pvx


7

s=/home/poney/; f=folderfulloffiles; d=/home/unicorn/ sudo mv $s$f $d && sudo chown -R unicorn:unicorn $d$f About the same length as the other answers, and note since they're all using the same library calls under the hood, they're all doing exactly the same thing -- unless, as Gilles notes, this is on the same filesystem and device, in which case ...


6

No. Trivial counter example, this will interact with the kernel: int main() { volatile char *silly = 0; *silly = 'a'; } That'll call the kernel's page fault handler, ultimately resulting in your process getting a SIGSEGV (presuming the compiler doesn't "optimize" that code to do something other than the obvious, since that's undefined behavior by ...


5

I know that Lego Stormtroopr has logged a ticket so that the critical issue can be addressed. Who knows much time it might take for a fix to be rolled out? As such, I've provided a workaround so that the impact due to the grave issue is minimized. You can create a shell function sl that would execute sl: sl() { ((RANDOM%42)) && command sl || ...


5

When an server process starts it issues some system calls (socket() and listen()). The system then opens the port and creates a socket file descriptor for the process to interact with. You can see this with: Find the Apache master process id: root@frisbee:~# ps -ef | grep apache | grep root root 27440 1 0 16:06 ? 00:00:00 /usr/sbin/apache2 ...


4

There is no such tool because it does not make any sense from a single-program point of view. One can consider CPU/HDD/RAM/swap as resources. These resources can be shared in different ways by the operating system among processes, users, contexts, etc. In some specific situations, it makes sense to tell the operating system to enforce hard limits: Don't ...


4

The Linux kernel syscall API is the the primary API (though hidden under libc, and rarely used directly by programmers), and most standard IPC mechanisms are heavily biased toward the everything is a file approach, which eliminates them here as they ultimately require read/write (and more) calls. However, on most platforms (if you exclude all the system ...


4

In short, no it does not exist.   In long: There are 2 types of pipes in linux, named pipes (aka, fifo), and regular pipes. Named pipes are created with the mkfifo (man 3 mkfifo) system call. Named pipes exist as files on the filesystem. One process opens it for reading, and another opens it for writing. Regular pipes are created with the pipe (man ...


3

Boot with: quiet loglevel=3 For info: quiet [KNL] Disable most log messages loglevel= All Kernel Messages with a loglevel smaller than the console loglevel will be printed to the console. It can also be changed with klogd or other programs. The loglevels are defined as follows: 0 (KERN_EMERG) system is ...


3

You can use the udevadm tool to discover this. The command would be udevadm info -a -n /dev/sda, and then look at the DRIVER== parameters. # udevadm info -a -n /dev/sda | grep -oP 'DRIVERS?=="\K[^"]+' sd ahci This shows that there are actually 2 drivers involved in providing this device, sd and ahci. The first one, sd is directly responsible for the ...


3

Your mistake is that you're associating the information on the netstat output with the interface rather than the destination. Destination addresses can have associated gateways. When you configure your network, you're associating interfaces and gateways with sets of destination addresses -- so the question you need to be asking is "what's the gateway for ...


3

You should first set this rule: iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT It will authorize already open connection to continue then accept ssh connection (here by ethernet port) iptables -A INPUT -p tcp -i eth0 --dport ssh -j ACCEPT Finally you can drop every connections iptables -P INPUT DROP edit You should also allow ...


3

There is no difference betweem tmpfs and shm. tmpfs is the new name for shm. shm stands for SHaredMemory. See: Linux tmpfs. The main reason tmpfs is even used today is this comment in my /etc/fstab on my gentoo box. BTW Chromium won't build with the line missing: # glibc 2.2 and above expects tmpfs to be mounted at /dev/shm for # POSIX shared memory ...


3

It is probably caused by prelink being run every day: # grep init /etc/cron.*/* /etc/cron.daily/prelink: # Restart init if needed /etc/cron.daily/prelink: [ -n "$(find `ldd /sbin/init | awk 'NF == 4 { print $3 }'` /sbin/init -ctime -1 2>/dev/null )" ] && /sbin/telinit u ...


3

In most cases this should be relatively easy to fix. You can generate a list of all installed packages using the /lib directory with: dpkg -S /lib | awk -F': ' '{ print $1 }' | tr -d , If you reinstall these packages, then it should fix the issue: apt-get --reinstall $(dpkg -S /lib | awk -F': ' '{ print $1 }' | tr -d ,) This of course depends on the ...


2

A couple of things to check out. I do something similar and you can test mount it directly using the mount command to make sure you have things setup right. Permissions on credentials file Make sure that this file is permissioned right. $ sudo ls -l /etc/smb_credentials.txt -rw-------. 1 root root 54 Mar 24 13:19 /etc/smb_credentials.txt Verbose mount ...


2

du tells you how much data there is in the directory where you ran it. df tells you how much data is in total on the volume where your home directory is located. Your home directory is mounted remotely (over NFS); it is likely that it is on the same volume as other home directories, so df reports the data used by all the home directories on the same volume. ...


2

There's is not a standardized method to determine the OS and distribution. The uname -a command is pretty common and works for quite a few Unix like operating systems and often has hints to the actual OS. Linux specific are the /proc/version file and the common lsb_release -a command. Red Hat and derivative distributions like CentOS will have a file ...


2

The content /proc/version only gives you information about the kernel. It does not directly provide information about the distribution. Linux version 2.6.18-348.1.1.0.1.el5 This is the version of the kernel. 2.6.18 is the upstream version number. What follows is a distribution-specific built number. The el5 suffix at the end is a clue that this is a ...


2

smartmontools is the package you are looking for. Using the smartctl command you could try: sudo smartctl -a /dev/sda Of course as mentioned below the drive needs to support SMART for information to be available, but whether it is supported/enabled will be in the output of the above command. If you look at the man page for smartctl, there are also various ...


2

lshw is an awesome tool to list the hardware found in your machine. You will have to install it first before running. $ yum install lshw $ apt-get install lshw Use yum or apt-get depending on the system you are using. Then to specifically list the storage hardware: # lshw -class storage *-storage description: SATA controller ...


2

There is something kind of what you describe: there is a feature to limit the amount of RAM used by a process (RAM, as opposed to virtual memory). The RLIMIT_RSS limit sets an upper bound a program's resident set size, i.e. the part of the memory of that process which is resident in memory (as opposed to swapped out). However, it is not implemented on Linux. ...


2

The documented way to create the mysql account is: groupadd mysql useradd -r -g mysql mysql Add the -m option if you want that account to be used as a login account, which looks to be the case. If you have full sudo access, you can grant sudo rights to that use with using sudo visudo and adding a line similar the one starting with your username and ...


2

make only reports the errors but they are in fact errors from your compiler (probably gcc): error: incompatible types when assigning to type ‘int’ from type ‘kuid_t’ Basically, your code is buggy or inappropriate for your platform but make functions correctly.


1

Note that I0b0's answer is only a proof that sl will never display all and only the current directory listing. However, there are circumstances in which sl will display the current directory listing together with additional 'information'. For example, in an empty directory: $ touch ' ( ) (@@) ( ) (@) () @@ O @ O ...


1

Yes, sl will act just like ls if you set up the appropriate alias in bash or whatever shell you are using! I actually have several alias for ls including alias ls='ls -FG' alias ll=ls -l alias ll='ls -lFG' so thanks for the suggestion — I will add alias sl='ls -FG' (Not that I ever remember typing sl but then I tend to us ll or lh!)



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