title: Logging %pre during kickstart - logfile doesn't exist after boot

text: I am kickstarting several EL6 systems and I want to log the actions taken in my `%pre` section. I know that I can log the `%post` section per the hints provided by centos.org: Tips and tricks for anaconda and kickstart using one of these two methods:               %post --log=/root/my-post-log     echo 'Hello, World!'      Or:               %post     exec < /dev/tty3 > /dev/tty3     chvt 3     echo     echo "################################"     echo "# Running Post Configuration   #"     echo "################################"     (     echo 'Hello, World!'     ) 2>&1 | /usr/bin/tee /var/log/post_install.log     chvt 1      However I can't get this to work with the `%pre` section. Here is what I'm using:               %pre --log=/var/log/my-pre-log     echo 'Hello, World!'      When I am finally allowed to use the Virtual Consoles, the logfile is not to be found anywhere on the system. This works fine for the `%post` section because at the time `%post` is executed, Anaconda switches to the new disks using `chroot`-- `/var/log/` actually exists on the new system, and thus the logfile will exist after a reboot. The problem with doing this with the `%pre` section is that the only filesystems available at the time is the memory-only filesystem. If I write the file to `/tmp/`, `/root/pre_install.log` or `/var/log` the filesystem disappears as soon as I shut down the machine. The debugging shell is not available until midway through the installation, which makes debugging difficult.


title: Is xfstt necessary?

text: I am using _Lubuntu 11.10_. Every time when I shutdown the system I can read on the black screen an error for trying to stop `xfstt`. I found info about this process here. I have `K20xfstt` in `/etc/rc0.d` and also in other folders. But I don't know if it is necessary. Probably I installed it during the installation of Maple or Java. I don't know! So, nowadays is necessary to use it or may I remove it?


title: How to compile my own linux kernel?

text: I want to learn about compiling a kernel from scratch. How can I download the latest stable Linux kernel from http://kernel.org/, compile it, and install it in a VMware virtual machine? This is just for educational purposes.


title: Configuring, compiling and installing a custom Linux kernel

text: I'd like to try using a kernel other than the one provided by my distro -- either from somewhere else, or as customized by me. Is this difficult or dangerous? Where do I start?


title: Executing programs without having to specify a directory?

text: Why is it that I have to type `/etc/init.d/apache2 (args)` in order to run apache?? Isn't there a way to just `apache2 args` ??


title: Grep for a string with list of files as source

text: I have a plain text file, in every line is a path to a file. Now I have to `grep` for a string in these files. Is there any way to use this file as "search source" for `grep`? Or do I have to copy and paste every path to the bash? 2nd: Is there a way to provide `grep` with different files as search source in one line? Like `egrep --color -i "test" /tmp/1.txt, /tmp/2.txt` ... ?


title: How to move files with same name and concatenate

text: My directory structure is given below. I need to move all the folders from Test3 to Test2 and concatenate the files with same names               [jg@hpc Test2]$ tree     .     |-- Sample_1008     |   |-- 1008_ATCACG_L002_R1_001.fastq     |   |-- 1008_ATCACG_L002_R2_001.fastq     |   |-- 1008_ATCACG_L006_R1_001.fastq     |   `-- 1008_ATCACG_L006_R2_001.fastq     `-- Sample_1009         |-- 1009_CGATGT_L002_R1_001.fastq         |-- 1009_CGATGT_L002_R2_001.fastq         |-- 1009_CGATGT_L006_R1_001.fastq         `-- 1009_CGATGT_L006_R2_001.fastq          [jg@hpc Test3]$ tree     .     |-- Sample_1008     |   |-- 1008_ATCACG_L002_R1_001.fastq     |   |-- 1008_ATCACG_L002_R2_001.fastq     |   |-- 1008_ATCACG_L006_R1_001.fastq     |   `-- 1008_ATCACG_L006_R2_001.fastq     `-- Sample_1009         |-- 1009_CGATGT_L002_R1_001.fastq         |-- 1009_CGATGT_L002_R2_001.fastq         |-- 1009_CGATGT_L006_R1_001.fastq         `-- 1009_CGATGT_L006_R2_001.fastq      I tried               mv Test3/* /auto/dr-lc_sa1/Data/Test2      nothing worked but when I tried               cp -r Test3/* Test2/      It overwrites. I want the files to be concatenated. At the end I need to have one Test2 directory and under every sample and their fastq files in the Test3 directory will be concatenated to corresponding fastq files in Test2 directory.


title: Rename file in Mac OS Terminal using Regex

text: Hundreds of images need to be renamed with a terminal command using regex on MacOS 10.9 Mavericks. The files are named this way:               0045AW489R3T(IPCAM)_0_20131124101245_931.jpg     0021DF025C8E(IPCAM)_0_20131127101721_44591.jpg     389223GT4Z6W(IPCAM)_0_20131128103423_7893282.jpg      They need to be renamed to this:               2013-11-24  10-12-45.jpg     2013-11-27  10-17-21.jpg     2013-11-28  10-34-23.jpg      Can anyone please show me how to do it?


title: Can SSH-Agent work from a remote bash script?

text: Server A needs to connect over svn+ssh to Server B to grab some source files for deploying on Server A. My deployment script runs from my local dev machine via:               ssh serverA 'bash -s' < deploy.sh       I have a passphraseless public/private key pair set up between Server A and Server B. When I log in a local session to Server A, I have keychain setup and svn+ssh connections to Server B aren't a problem. The deploy.sh script runs successfully on Server A from a local session. However when SSHing into it from my dev box the same script will not run remotely. What way do I call ssh-agent from my deploy script to get Server B to accept connections from it when I run the commands remotely on Server A?


title: Partioning free space for manual install

text: I have 53 gigabytes that need formating into /root, /swap, /usr/, /var, /home, and /tmp. If there's any help what is the best space allocation? Please let me know.


title: How can I connect to a wireless network with hidden SSID using the terminal?

text: I'm starting to learn about wireless pentesting with BackTrack, and while learning how to find out the hidden SSID I wondered how could I connect to the wireless network after I discover the SSID. The book I'm studying does not cover that topic, only how to find the SSID. I tried:               ifconfig wlan0 192.168.0.1 netmask 255.255.255.0 up               iwconfig wlan0 essid "XXXX" channel X but that doesn't work. Result in screenshot: ![enter image description here](http://i.stack.imgur.com/Yk7sy.png)


title: "system-config-network-tui &" doesn't work

text: When I try to edit or assign the IP using this command:               system-config-network-tui &      Terminal opens a console which is uncontrollable, just like this: ![Redhat](http://i.stack.imgur.com/TjNmg.png) This happens on CentOS and Red Hat.


title: How to set the Linux Mint desktop environment to use a mime type?

text: As a extension to this question: How to make difference between .wxm (wxMaxima) and .c files in Linux Mint? I'm using Linux Mint. I created a mime type. Now I want the desktop environment to use it. How do I do that? If you need any more data, just ask.


title: How to forward port by (sub)domain name?

text: I have this setup: a `(Host) FreeBSD 9.2 host server` running VirtualBox with another `(Guest) FreeBSD guest server`. I have set up port forwarding on the `Host` to the `Guest` like this:               VBoxManage modifyvm "Guest" --natpf1 "guestssh,tcp,,9201,,22"     VBoxManage modifyvm "Guest" --natpf1 "guestmysql,tcp,,9202,,3306"     etc ...      This works fine. I can for example `ssh -p 9201 user@localhost` just fine. Also I have a domain (let's say `example.com`) with DNS adress record pointing to the `Host` ip. And this also works as expected `ssh -p 9201 user@example.com`. Beside the main domain I have subdomains like `ssh.example.com`, `mysql.example.com`. Now I need incoming traffic from those domains to be forwarded to specifc ports on the virtual machine. So               ssh.example.com:22 -> localhost:9201     mysql.example.com:3306 -> localhost:9202      For SSH this is easily achieved on a single *nix clinet by setting up `~/.ssh/config` like this:               Host ssh.example.com         Port 9201      But I need to forward services other then SSH as well (like MySQL, VNC, HTTP, etc.). Plus the ports may change as I'll add new Virtual Machines for specific services. **So my question is** : how can I configure the `Host` machine to forward incoming traffic `domain_name:port1` to `localhost:port2`? I've tried to set up firewall for this, but this was obviously wrong way to go, as the domain names resolve to ip adresses. Setting up a SSH forwarding with `ssh -L` is also a bad idea. So what else is left? **EDIT** : I can acces the raw DNS record and reconfigure it, so I was thinking maybe if I can bind some kind of information to the domain and catch it with a proxy software on the `Host` side?


title: How to ignore files if there is an similar file with the same size?

text: I want to list the files in a directory, using ls. Typically, the files in that directory have the same name (except for the extension - one has extension .rej, one has .failed) . If a pair of files with similar names have the same size, move the .failed file to a specific directory, and leave the .rej alone. How can I do this?


title: Why are the timestamps on files so old on my newly installed system?

text: I installed the Red Hat Enterprise Linux 5.6 on a client system today. If it is of any concern, it's running on the bare metal. After the installation was completed, I did `ls -ltr /` and it showed a complete list along with dates of files and folders. To my surprise, the dates mentioned there are some time in the past, way before I started the installation. ![enter image description here](http://i.stack.imgur.com/2JcVo.jpg) Can someone clarify on what's going on here?


title: What's the best way to create a backup on a linux system?

text: probably this a is very silly question but I want to know what is the best way to create a backup of my computer (I'd also like to save configuration files like .vimrc, etc.), I have been reading about using the tar tool to do this, is this a good way?


title: vim insert current filename into the contents

text: After some searching, I got to know `:echo @%` display's the current file-name in the bottom line of vim-screen. I would like to dump the file-name(with and without full path) into the contents of the file without leaving `vim`. Is there any way to do this?


title: copy logical volume from one volume group to another

text: I want to copy a logical volume from one volume group to another on AIX. How can I do this? Is `copyvg` the right command?


title: How to repair the grub on debian

text: I am loading Linux (Debian Lenny) on VirtualBox but there is apparently something wrong with the GRUB. When I start the system, a grub menu appears: ![enter image description here](http://i.stack.imgur.com/mNBaP.png) Then I run the following commands: > root (hd0,0)   >  kernel /vmlinuz root=/dev/hda1 ro quiet   >  initrd /initrd.img   >  boot After the system boots, how should I continue to repair the grub file? Any advice would be appreciated!


title: Startup hangs after starting mysqld

text: I've upgraded my virtual machine from Suse 12.2 Milestones 3 to 12.2 Beta 1 as suggested by zypper, but now I can't boot into my desktop -- the boot stops after starting the MySQL database server. I can boot into a recovery console, but I don't know how to fix this problem. This forum thread didn't help, nor did adding the `nomodeset` boot parameter. What's going wrong? At the very least, how can I start X in failsafe mode to debug it? Edit: My Xorg is owned by root and I have set setuid bit to no avail. But runlevel 3 seems to work (network connection).


title: No version information available?

text: How can I fix this problem? What is libzypp.so.1106 and and libaugeas.so.0? Why is this error repeated so many times in libzypp.so.1106?               zypper: /usr/local/lib64/libxml2.so.2: no version information available (required by / usr/lib64/libzypp.so.1106)     zypper: /usr/local/lib64/libxml2.so.2: no version information available (required by /usr/lib64/libzypp.so.1106)     zypper: /usr/local/lib64/libxml2.so.2: no version information available (required by /usr/lib64/libzypp.so.1106)     zypper: /usr/local/lib64/libxml2.so.2: no version information available (required by /usr/lib64/libzypp.so.1106)     zypper: /usr/local/lib64/libxml2.so.2: no version information available (required by /usr/lib64/libaugeas.so.0)


title: Set default window manager (i3) in OpenSuse

text: How do I set the default window manager in OpenSuse in CLI? I've a CLI installation and would like to set i3 as default window manager...


title: Understanding grep --label=

text: I am looking for an explanation how `grep --label=LABEL` works: Maybe somebody can give me an example [or two] on what `\--label=` is for. I understand what `grep` and `zgrep` are supposed to do - the latter is mentioned in the entry on `\--label=` in the `info page`: > ... especially useful when implementing tools like `zgrep' 98% of what I found so far is copy/paste from `info grep` and the other two percents the command is embedded in a script which I don't understand.


title: Debian Wheezy youtube video missing on page

text: have just installed Debian Wheezy XFCE. Installed Flash via this tutorial So I restarted IceWeasel, and I don't get the warning to install Flash now. But when on a YouTube video page, everything but the YouTube video loads. The pic here is the example. ![PiC](http://i.stack.imgur.com/xt6Xk.png)


title: script to calculate the average

text: We have a big file in which three columns are there that is hour, response time and service name. These fields are separated by space. We need write a script to calculate the number of occurrence of the service name on an hourly basis and find the average of response time. A piece of file is shown below.               15 999 createLead     15 999 getLead     15 999 jointCall     15 999 searchLead     16 1002 jointCall     16 1019 createLead     16 1031 jointCall     16 1032 jointCall     16 1040 jointCall     16 1044 jointCall     17 1011 createLead     17 1027 createLead     17 189 getLTSUserDetails     19 1439 searchLead     19 1708 searchFileStatus     19 1832 updateLead


title: How to rotate tcpdump files?

text: I want to take a continuous dump file of particular size and after the dump reached it predefined size the new data should overwrite the file. Help


title: Can the empty spaces/background in a terminal be replaced with a random(but pretty) pattern of ASCII characters?

text: ## Context and Question There are many ways to colorize the terminal and shell environment. The output of individual commands, such as `ls` and `grep`, can also be colorized. Not directly related but interesting nonetheless is the notion of playing media at the console but this seemingly relies on some framework (libraries) on top of the windowing system. The following question is geared solely at the `bash` shell and its implementation in the Linux terminal framework and its underpinnings. Please consider the following montage of ASCII "renderings" of a scene in a 2D game: ![Nature scene\(trees, shrubs, flowers, grass\) from the Dwarf Fortress game - the first 2 screens show the game with no tileset\(ASCII only\), the third screen is generated with the Vherid tileset, the next 2 screens are generated with the CLA tileset, and the last screen is generated with the Jolly Bastion tileset](http://i.stack.imgur.com/flnBz.jpg) These are not randomly generated scenes. The segments I've selected all actually depict some form of "grassland" terrain (trees, bushes&shrubs, flowers, grass etc.) from a game that uses ASCII characters to represent such objects. The last 4 scenes showcase user made tilesets which are basically a remap of ASCII characters with color specs (such details are trivial - suffice it to say that this is the visual inspiration for what I'm trying to accomplish here in terms of visuals and "pattern"). The common features those scenes in the montage share are:   * 5-6 different ASCII characters at most (commas, quotations marks and a few others)   * 2-4 colors used      * for the characters     * for the character backgrounds in some cases - the last example is there to show the use of color shades with little or no character to create a pattern i.e. color mosaic  What I have in a VM at the moment is _Arch Linux_ and although the question is not distribution specific, I've looked into their documentation for customizing the `/etc/bash.bashrc` file. I can see that lots of explaining go into configuring the appearance of the prompt and generally all the foreground elements. There is little information on any configuration for the background, except usually for a solid color, such as these settings and tips:               # Background     On_Black='\e[40m'       # Black     On_Red='\e[41m'         # Red     On_Green='\e[42m'       # Green     On_Yellow='\e[43m'      # Yellow     On_Blue='\e[44m'        # Blue     On_Purple='\e[45m'      # Purple     On_Cyan='\e[46m'        # Cyan     On_White='\e[47m'       # White      I still don't conceptually grasp what are those empty/blank/background "spaces" that I didn't type when I use the console i.e. "what are they made of?" so to speak. Especially those that are not at the prompt, and which wrap around the commands that are echoed. In respect to what happens on the active line, it is possible to demonstrate that `bash` acts in a "line-oriented" way and that some operations trigger a clearing of the active line (`for i in $(seq 1 $(expr $(tput lines) \\* $(tput cols))); do echo -n M; done; tput cup 15 1`, then at the prompt type a char and backspace it - demonstrated a contributor) - the extent of which may vary from a CLI to another i.e. zsh. Furthermore, it seems when I add something like `\\[\033[44m\\]` to my PS1 line in `bash.bashrc` I get a blue background after reloading bash - so obviously I know that there is _some_ leverage here over of the output appearance insofar as the _background_ is concerned. But I also know that bash is a piece of software relying on some other facility in the form of the TTY subsystem for bringing things to the screen - and this goes down from there to the VT component in the kernel I assume. `pstree -Ap` on Arch shows `systemd` linked to `login` and then to `bash`. The _Arch Linux_ distribution relies on `agetty` for TTY services. A simple `echo $TERM` will yield the type of terminal in use ("linux" here outside of any DE) and the `infocmp[-d spec1 spec2]` command with no parameter shows the active terminal capabilities and profile information from the terminfo(5) terminal database:               # Reconstructed via infocmp from file: /usr/share/terminfo/l/linux     linux|linux console,     am, bce, ccc, eo, mir, msgr, xenl, xon,     colors#8, it#8, ncv#18, pairs#64,     acsc=+\020\,\021-\030.^Y0\333'\004a\261f\370g\361h\260i\316j\331k\277l\332m\300n\305o~p\304q\304r\304s_t\303u\264v\301w\302x\263y\363z\362{\343|\330}\234~\376,     bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[?25l\E[?1c,     clear=\E[H\E[J, cnorm=\E[?25h\E[?0c, cr=^M,     csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H,     cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C,     cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A,     cvvis=\E[?25h\E[?8c, dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m,     dl=\E[%p1%dM, dl1=\E[M, ech=\E[%p1%dX, ed=\E[J, el=\E[K,     el1=\E[1K, flash=\E[?5h\E[?5l$, home=\E[H,     hpa=\E[%i%p1%dG, ht=^I, hts=\EH, ich=\E[%p1%d@, ich1=\E[@,     il=\E[%p1%dL, il1=\E[L, ind=^J,     initc=\E]P%p1%x%p2%{255}%*%{1000}%/%02x%p3%{255}%*%{1000}%/%02x%p4%{255}%*%{1000}%/%02x,     kb2=\E[G, kbs=\177, kcbt=\E[Z, kcub1=\E[D, kcud1=\E[B,     kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[3~, kend=\E[4~, kf1=\E[[A,     kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf13=\E[25~,     kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, kf17=\E[31~,     kf18=\E[32~, kf19=\E[33~, kf2=\E[[B, kf20=\E[34~,     kf3=\E[[C, kf4=\E[[D, kf5=\E[[E, kf6=\E[17~, kf7=\E[18~,     kf8=\E[19~, kf9=\E[20~, khome=\E[1~, kich1=\E[2~,     kmous=\E[M, knp=\E[6~, kpp=\E[5~, kspd=^Z, nel=^M^J, oc=\E]R,     op=\E[39;49m, rc=\E8, rev=\E[7m, ri=\EM, rmacs=\E[10m,     rmam=\E[?7l, rmir=\E[4l, rmpch=\E[10m, rmso=\E[27m,     rmul=\E[24m, rs1=\Ec\E]R, sc=\E7, setab=\E[4%p1%dm,     setaf=\E[3%p1%dm,     sgr=\E[0;10%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p5%t;2%;%?%p6%t;1%;%?%p7%t;8%;%?%p9%t;11%;m,     sgr0=\E[0;10m, smacs=\E[11m, smam=\E[?7h, smir=\E[4h,     smpch=\E[11m, smso=\E[7m, smul=\E[4m, tbc=\E[3g,     u6=\E[%i%d;%dR, u7=\E[6n, u8=\E[?6c, u9=\E[c,     vpa=\E[%i%p1%dd,      As it stands, many capabilities can be leveraged from the terminal framework and it is basically those features which are exposed in the bash.bashrc configuration file insofar as the prompt is customized by setting the PS1 variable. Control and escape sequences are used to basically interrupt the flow of character displaying in the terminal in order to supply functions, including moving the cursor and other capabilities described in the terminal information database. Many of those functions are passed in using the well known `ESC[` (or \33) _Control Sequence Introducer_ (more sequences here and here, and some examples). Furthermore, it is also possible to use the `tput` utility directly on the CLI to change some terminal properties; for instance `tput setab 4` will have bash echo commands on a blue background. If we `strace bash` we can see both the escape sequences and behavior in action:               write(2, "[il@Arch64vm1 ~]$ ", 19[il@Arch64vm1 ~]$ ) = 19  //bash starts     rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0     rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0     read(0, " ", 1) = 1                                 //pressed <space>     rt_sigprocmask(SIG_BLOCK, [INT], [], 8) = 0     write(2, " ", 1 ) = 1     rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0     rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0     read(0, "\177", 1) = 1                              //pressed <backspace>...     rt_sigprocmask(SIG_BLOCK, [INT], [], 8) = 0     write(2, "\10\33[K", ) = 4                          //triggers erasing the line     rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0     rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0     read(0, "\33", 1) = 1                               //pressed <esc> per se      This provides context for the question _Can the empty spaces/background color in a terminal be replaced with a random(but pretty) set of ASCII characters?_ but gives no idea of how to implement the features or of what I'm looking for in the terminal. So I've created a crude mockup as an example of what the end result could look like if this were possible (no seriously:): ![Mockup of a terminal displaying a set of colored ASCII characters as a background instead of just a solid black color. The pattern wraps around the output of executed commands. The active command line has a different pattern/color but this pattern never gets interpreted by the CLI to preserve full functionality of the shell ](http://i.stack.imgur.com/NbO8f.jpg) Basically all the "empty space" in the terminal would be filled with the pattern(here I "tile" one of the image from above but I would like in the actual implementation for each individual "blank" to be generated randomly from the set of 5-6 characters and features documented from the montage which would be specified). There is a different pattern for the active command line i.e. wavy "water" but I'd settle for the line being blue. As this was imagined, commands would "erase" the "water" as they get typed on the active line and of course a constraint would be that the pattern of characters never gets interpreted by the CLI otherwise it would make it useless. So is there any configuration exposed in `bash` or in the terminal framework proper, or a script which would allow to use a set of characters and some control over colors to modify the output of bash in terminal so as to generate a somewhat random pattern for the background (which would be similar to what I've shown above)? Or should I simply settle for something like trying to supply a full pattern image as a background for the tty? ## Implementations **0.1 - PatternOTD version(one shot deal when you login)** The following expression I added to my .bashrc file puts together some of the notions we explored and constitutes a (very)basic proof of concept for the visuals in the standard linux terminal:               for i in $(seq 1 $(expr $(tput lines))); do echo -en '\E[32;32m'$(tr -dc '",.;:~' < /dev/urandom | head -c $(tput cols)); done; tput cup 15; tput setab 4; echo -en "\E[2K"; tput setab 0      ![enter image description here](http://i.stack.imgur.com/0Eofz.png) _Observations_   * It's obviously just a command so not persistent i.e. it scrolls away as commands get typed   * Opted to not individually randomize the selection of characters i.e. `head -c 1` with the `tput cols` multiplying the lines to begin with, which would print individual random chars from the quoted selection - because it's too slow. I don't think `random` generates a (tput cols) long integer but still it's faster lol. Surely this is all very wasteful but it works.    * Haven't randomized any color or effect per character or otherwise except for that green because as I explained rendering/processing each char individually is too slow. Re: framebuffer?   * I'm happy to see that the pattern doesn't interfere with CLI usage in the sense of not being interpreted by the CLI! (why though I couldn't explain)   * Water is gone too fast! ;-) **0.2 - PROMPT_COMMAND hack job** The value of the variable PROMPT_COMMAND is examined just before Bash prints each primary prompt. I know usually you would use the variable to call a script where you could process elements from the display etc. but I'm rather trying to do this directly in my .bashrc file. Initially I thought I could implement some positional awareness i.e. where is the cursor before execution (so I could go render things on screen anywhere with `tput` then come back to the position I was before, using something like this to extract position:               stty -echo; echo -n $'\e[6n'; read -d R x; stty echo; echo ${x#??}  //value is in x;x format so...      I would pipe the value to `cut -f1 -d";"`. I can do this on the CLI but making this work inside the sequence of elements in the PS1/P_C variables is out of my reach at the moment and it's possible that whatever command is put in PROMPT_COMMAND may not be evaluated at every carriage return but rather only once(?) despite being executed every time (see observations below). So the best I could do is carry over my initial sequence and add some commands to both PROMPT_COMMAND and the definition of the PS1 variable in .bashrc. Like so:               PROMPT_COMMAND="echo -en '\E[32;32m'$(tr -dc ',.:~' < /dev/urandom | head -c $(echo "$[$(tput cols) * 2]"))"          PS1="$(echo -en '\n') $(tput setab 4)$(echo -en "\E[2K")$(tput setab 0)\[\033[7;32m\]df:\[\033[1;34m\] \W @d \[\033[0m\]\e[32m"          for i in $(seq 1 $(expr $(tput lines))); do echo -en '\E[32;32m'$(tr -dc '",.;:~' < /dev/urandom | head -c $(tput cols)); done; tput cup 1; tput setab 4; echo -en "\E[2K"; tput setab 0      In summary I'm using P_C to try to implement a persisting visual pattern i.e. 2 lines get added. Unfortunately I cannot succeed at creating both this pattern while repeating my "water" trick i.e. having the active line blue (which is just changing the background color, doing a clear line, then changing the background back to black). I've put together an image to show how this plays together: ![enter image description here](http://i.stack.imgur.com/u1gYS.jpg) _Observations_   * Using backspace on a line still triggers the clear line behavior and the blue is gone   * Each time the enter key is pressed we have 2 lines of pattern before the new active line   * Of course as we see further down despite the extra lines we're not wrapping the pattern on the side of the commands such as `ls`   * /dev/urandom 's randomness seems not so random when called here in P_C. This image is made out of 2 images, but it's easy to pick up that the extra 2 lines pattern is always the same i.e. the randomness is not generated with every enter keypress but only one time for each of the two lines - possibly only the first time .bashrc is read by `bash`.   * The content of the PS1 variable starts with `$(echo -en '\n') $(tput setab 4)` - well that space in the middle there, just before $(tput ...), it MUST be there for this to work. Otherwise the blue line appears on top of the prompt and not in front of it and I can't resolve that. And this hack is what gives its name to 0.2. :) **0.3 -`tput cuu` & `tput cud`**               for i in $(seq 1 $(expr $(tput lines))); do echo -en '\E[0;32m'$(tr -dc '",.o;:~' < /dev/urandom | head -c $(tput cols)); done; tput cup 1          PROMPT_COMMAND="echo -en '\033[0;32m$(tr -dc ',;o.:~' < /dev/urandom | head -c $(tput cols))\n\033[36;44m$(tr -dc '~' < /dev/urandom | head -c $(tput cols))\033[0;32m$(tr -dc ',.o+;:~' < /dev/urandom | head -c $(tput cols))'$(tput cuu 2)"          PS1="\[\033[0m\] \[\033[1;32m\][1]\[\033[7;32m\]=2=:\W)\[\033[0;32m\]=3=\[\033[1;32m\]=4=@>\[\033[0;32m\]"      What is done with PROMPT_COMMAND is that 3 lines of patterns are printed every time before the prompt is generated - and those 3 sets of patterns are individually generated within the constraints explained in 0.2 - meaningless for the water as it's 1 char but still. Then we go up two lines (using `tput cuu 2`) and the prompt is generated on the middle line according to PS1. We still have our initial set of command for the full screen pattern on .bashrc load which is executed only once when we log in to the terminal. Now we have some padding around the active line which has its own blue pattern which always gets repeated when there's a return carriage. The contents of the PS1 variable and the P_C have been sanitized. The syntax of the escape sequences and color coding embedded within long `echo` sequences can be tricky. Errors lead to weird terminal behavior including lines that overwrite each other, a prompt that appears away from the left margin or unusual output to stuff that has been processed unintentionally. A condition exists with what I'm doing, where an extra space is required inside the PS1 variable to counter a visual difference between the linux terminal and lxterm with my setup (Arch Bang). Without the extra space, the linux terminal prints the first character of the prompt at the end of the last line for some reason I can't figure out (of course it's something that I do and not the default behavior). Also can't figure out how to generate some random effect (bold, inverse etc) to the set of chars in quotation marks, as it was decided early on to generate longer strings to increase performance. There is still no real persistence of the pattern outside the padding around the prompt, but at least there's the water and it's simpler than before and somewhat more predictable. _Initial pattern when the terminal opens_ ![enter image description here](http://i.stack.imgur.com/GIxh6.jpg) _Behavior after a`clear` and pressing enter successively at the prompt_ ![enter image description here](http://i.stack.imgur.com/QrOmF.jpg) _Observations_   * Should be redesigned or modified to implement colorizing the patterns beyond doing it in bulk   * Starting to feel that going much further will require either putting all that into a script or leverage some higher form of abstraction. But the terminal capabilities are quite enabling for the end user (reminds me of "logo")!


title: How to calculate by taking first field

text: I am trying to do a calculation like this, I have a text file with numbers like               459     455     463      And I must calculate percentage of those numbers relative to 600. I mean exactly `(459/600)*100` that will be my percentage, `459` being obtained from the text file. Could somebody help me please ?


title: How to search in specific files matching a pattern

text: How can I find a word in specific files matching a pattern. e.g. searching for `version` in `CMake*` files recursively found in the current directory.


title: Spoofed MAC address ignored by wpa_supplicant?

text: I'm using wpa_supplicant to power my wireless card in my Ubuntu Server (yes I know wireless in a server is bad, but this is a special case) since it has the ability to automatically roam WAPs instead of just dying. However it seems my spoofed MAC address is being ignored Here's the important part in `/etc/network/interfaces`:               auto wlan0     iface wlan0 inet dhcp         hwaddress 00:11:22:55:55:D1         wpa-driver madwifi         wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf      As you can see, `hwaddress` is defined there but wpa_supplicant doesn't seem to care and just uses the actual hardware address Is there any way to have wpa_supplicant use a spoofed MAC address instead of the real MAC address?


title: RAID setups questions

text: I have a RAID setup questions My mobo supports hardware RAID, my question is, should I use the board's RAID system or freeNAS/Ubuntu's software RAID system? I realize performance is better with h/w, but my concern is what happens when a drive fails? I want to go with whatever option allows me to keep the data accessible after failure. I.E. drive 1 of a RAID 1 pair fails, I want the second drive to still be accessible to me if a) I swap a new drive in and or b) I take the good drive out and put it in another system. I've never messed with it and I've heard that software RAID setups can render a drive unusable in other systems and I've heard the same said of hardware setups so, which is it?? This setup will be for an NAS type of server.


title: CentOS: disable a non-reachable repository

text: **How to disable a non-reachable repository?** I have an error when I use `yum repolist` or `yum list`:               # yum list | grep 404     http://download.opensuse.org/repositories/home%3A/SannisDev/     CentOS_CentOS-    5/repodata/repomd.xml: [Errno 14] HTTP Error 404: Not Found     Trying other mirror.      And indeed the url is not reachable:               # ping opensuse.org     PING opensuse.org (130.57.5.70) 56(84) bytes of data.     From 10.2.15.2 icmp_seq=1 Destination Host Unreachable      But I can't find the repository in `/etc/yum.conf`:               # grep opensuse /etc/*


title: CentOS 7 Installation Failed

text: After hearing the news that CentOS 7 had been published, I decided to install it on my computer. I downloaded the ISO image from the CentOS official website (the one named `CentOS-7.0-1406-x86_64-DVD.iso`) and then burned it onto a USB drive by using a tool named UltraISO. After that, I rebooted my computer and pressed `F12` to choose my boot device. (My GIGABYTE motherboard uses `F12` to choose a boot device.) I chose this: `UEFI: hp v245o 1100`, where `hp v245o 1100` is the USB name, and I suppose this is a so-called _EFI boot from USB_. After that, three menu selections are presented:   1. Install CentOS 7,   2. Test this media & install CentOS 7,   3. and Troubleshooting -->. At first I decided to choose option 1 to let it display all its running messages, so I typed `e` and here is what I get:               set params 'Install CentOS 7'     linuxefi /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=CentOS\x207\x20x86_64 quiet     initrdefi /images/pxeboot/initrd.img      So I removed the `quiet` param and pressed `CTRL``x` to start, then I got this:     ![fb error](http://i.stack.imgur.com/ps7r6.jpg) I have no idea what the fb is, and the installation process just stopped there. So I decided to try the 3rd option (the `Troubleshooting -->` one) with no luck; I still cannot install this CentOS 7 and I got something like:               > [7.471771] scsi 0:0:0:0: alua: not attached     > [7.474665] sd 0:0:0:0: [sda] no Caching mode page found     > [7.474682] sd 0:0:0:0: [sda] Assuming drive cache: write through     > dracut-initqueue[685]: Warning: Could not boot     > dracut-initqueue[685]: Warning: /dev/root does not exist      How I can solve this problem?


title: see actual partitions usage

text: I have recently learned that ext3 (or some other filesystems) reserve some space of a drive by default for previliged processes. One can change this by doing the following:                # tune2fs -m 4 /dev/sdXY      where 4 in this case is the percentage to reserve. If I run df -h before and after that command I see the impact on the output of df. I was wondering if there was a way to see the actual usage of the partitions. Something like df -h gives but without taking the reserved bits into account.


title: Upgrading Debian Squeeze To Wheezy - Should conf' files be kept or replaced?

text: I am currently upgrading my **all-new** Linode server running Debian 6 (Squeeze) to 7 (Wheezy) this way:   1. Updating current system:              sudo apt-get update && sudo apt-get upgrade        2. Replace all instances of 'squeeze' with 'wheezy' in `/etc/apt/sources.list` file   3. Running the upgrade process:              sudo apt-get update && sudo apt-get dist-upgrade      It so happens that after issuing the last command (as in #3), during the course of upgradation, I am asked two, and only two questions: * * * ## (1)               Configuration file `/etc/default/rcS'      ==> File on system created by you or by a script.      ==> File also in package provided by package maintainer.        What would you like to do about it ?  Your options are:         Y or I  : install the package maintainer's version         N or O  : keep your currently-installed version           D     : show the differences between the versions           Z     : start a shell to examine the situation      The default action is to keep your current version.     *** rcS (Y/I/N/O/D/Z) [default=N] ?      **UPDATE:** Here's the diff for `/etc/default/rcS`:               --- /etc/default/rcS    2011-11-25 23:11:55.000000000 +0000     +++ /etc/default/rcS.dpkg-new   2012-08-31 20:14:04.000000000 +0000     @@ -7,11 +7,18 @@      #      # This file belongs to the "initscripts" package.          -TMPTIME=0     -SULOGIN=no     -DELAYLOGIN=yes     -UTC=yes     -VERBOSE=no     -FSCKFIX=no     -RAMRUN=no     -RAMLOCK=no     +# delete files in /tmp during boot older than x days.     +# '0' means always, -1 or 'infinite' disables the feature     +#TMPTIME=0     +     +# spawn sulogin during boot, continue normal boot if not used in 30 seconds     +#SULOGIN=no     +     +# do not allow users to log in until the boot has completed     +#DELAYLOGIN=no     +     +# be more verbose during the boot process     +#VERBOSE=no     +     +# automatically repair filesystems with inconsistencies during boot     +#FSCKFIX=no      ## (2)               Configuration file `/etc/dhcp/dhclient.conf'      ==> Modified (by you or by a script) since installation.      ==> Package distributor has shipped an updated version.        What would you like to do about it ?  Your options are:         Y or I  : install the package maintainer's version         N or O  : keep your currently-installed version           D     : show the differences between the versions           Z     : start a shell to examine the situation      The default action is to keep your current version.     *** dhclient.conf (Y/I/N/O/D/Z) [default=N] ?      **UPDATE:** Here's the diff for `/etc/dhcp/dhclient.conf`:               --- /etc/dhcp/dhclient.conf     2011-11-25 14:38:21.000000000 +0000     +++ /etc/dhcp/dhclient.conf.dpkg-new    2012-09-14 03:24:53.000000000 +0000     @@ -14,6 +14,7 @@      option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;           #send host-name "andare.fugue.com";     +send host-name = gethostname();      #send dhcp-client-identifier 1:0:a0:24:ab:fb:9c;      #send dhcp-lease-time 3600;      #supersede domain-name "fugue.com home.vix.com";     @@ -21,10 +22,8 @@      request subnet-mask, broadcast-address, time-offset, routers,             domain-name, domain-name-servers, domain-search, host-name,             netbios-name-servers, netbios-scope, interface-mtu,     -       rfc3442-classless-static-routes, ntp-servers,     -        dhcp6.domain-search, dhcp6.fqdn,     -        dhcp6.name-servers, dhcp6.sntp-servers;     -require subnet-mask, domain-name-servers, host-name;     +       rfc3442-classless-static-routes, ntp-servers;     +#require subnet-mask, domain-name-servers;      #timeout 60;      #retry 60;      #reboot 10;      * * * So, what should my answer have been in each case? `Y` or `N` **NOTE:** Please do keep in mind that it's a new virtual machine, and that I am upgrading to Wheezy right after setting the hostname and FQDN.


title: Become operator on all channels ircd-hybrid

text: I have a problem with my `ircd-hybrid` server. I can only make myself operator in the status tab but not when I join channels. There is my operator tag in `ircd.conf`:               operator {         /* name: the name of the oper */         name = "operator";              /* user: the user@host required for this operator.  CIDR is not          * supported.  multiple user="" lines are supported.          */         user = "*@127.0.0.1";              /* password: the password required to oper.  By default this will          * need to be encrypted using '/usr/bin/mkpasswd'.          * WARNING: Please do not mix up the 'mkpasswd' program from           * /usr/sbin with this one. If you are root, typing 'mkpasswd'           * will run that one instead and you will receive a strange error.          *          * MD5 is supported. If you want to use it, use mkpasswd -Hmd5.          */         #password = "3ZokNTld506nY";         password = "$1$oqD3q/0S$wQ1utcJG9Pcutmq6i3qxS.";              /* class: the class the oper joins when they successfully /oper */         class = "opers";              /* privileges: controls the activities and commands an oper are           * allowed to do on the server.  All options default to no.          * Available options:          *          * global_kill:  allows remote users to be /KILL'd (OLD 'O' flag)          * remote:       allows remote SQUIT and CONNECT   (OLD 'R' flag)          * kline:        allows KILL, KLINE and DLINE      (OLD 'K' flag)          * unkline:      allows UNKLINE and UNDLINE        (OLD 'U' flag)          * gline:        allows GLINE                      (OLD 'G' flag)          * nick_changes: allows oper to see nickchanges    (OLD 'N' flag)          *               via usermode +n          * rehash:       allows oper to REHASH config      (OLD 'H' flag)          * die:          allows DIE and RESTART            (OLD 'D' flag)          * admin:        gives admin privileges.  admins          *               may (un)load modules and see the          *               real IPs of servers.          */         global_kill = yes;         remote = yes;         kline = yes;         unkline = yes;         gline = yes;         die = yes;         rehash = yes;         nick_changes = yes;         admin = yes;     };      Also, how can I configure the server so that when a user joins a channel first, they do not become an operator for the channel?


title: Solaris 10 - what is appserv and boot.server? What do they do?

text: I'm working in a Solaris 10 zone on legacy startup scripts in the /etc/rc3.d/ There are two items that I don't know what they do. I know how legacy start-up works but just don't know what these items are supposed to do.               S16boot.server     S84appserv      I'm trying to establish the consequence if I remove them.


title: Reading the contents of the file and splitting using ksh

text: We're using a `ksh` script for installing one product. I've another config file, I'd need to read this configuration file from my main script Content of the Configuration file:               BPWS_Instance_1:Linux:x86_64:YES:/hosting/download:BPWS_Linux_64.jar     paymon_Instance_1:Linux:i686:YES:/hosting/download:paymon_Linux_32.jar      So now in my main script after reading the configuration file If I've **BPWS_Instance_1** ( this is the instance name ) which is running ( **YES** = Running ) on the Linux OS 64 bit processor ( **Linux:x86_64** ) then I'd need to get the **BPWS_Linux_64.jar** file from the location **/hosting/download**. Can someone help me with this ?


title: Why is it that , to newline is working but newline to , is not working sed?

text: I have got a text file with a list of first names, and I am trying to replace newline with **,**. Here is the command I am using               sed 's/\     /,/g' file      while the reverse is working               sed 's/,/\     /g' file      it replaces `,` with newline.


title: What is the utility of the : command in shell scripting, given that it explicitly does nothing?

text: In the answer to this question about comments in shell scripting, it is indicated that the `:` is a null command that explicitly does nothing (but is not to be used for comments). What would be the utility of a command that does absolutely nothing?


title: Fusing old "KNotes" repository into a "KNnotes" repository on a new KDE installation

text: _(Migrated from "superuser"; I will probably manage to actually test this over the weekend. Meanwhile...)_ I want to migrate the KDE Knotes database from an account that existed on a Fedora 17 installation (`kdepim 4.10.5`) to a new account that exists on a Fedora 20 installation (`kdepim 4.13.3`). Looking at Fedora 20, I have found that the notes text content is contained in an iCalendar file called `notes.ics` located under `~/.kde`. Additionally, a copy of each note, this time in RFC2822 format can be found under `~/.local`; this may be for desktop searching (Akonadi etc.) purposes, I don't know. I have a copy of the `notes.ics` file from the Fedora 17 installation. So, what do I do? Can I just take the old account's `notes.ics` and append it to the new account's `notes.ics`? Is this going to work? ![KNotes files in ~](http://i.stack.imgur.com/aRqS7.png)


title: Getting the process-id out of command launched with "su -c"

text: I am running a java program inside a shell and writing the process-id to a text file. So when I do this:               nohup java app.Main > /dev/null 2>&1 &     echo $! > /var/run/app.pid      It works. But I really want to run it as another user               su - appuser -c "nohup java app.Main > /dev/null 2>&1 &"     echo $! > /var/run/app.pid      This doesn't work. Is there any way of getting the process-id of the command launched with the -c option?


title: How to configure a "point-to-point" connection with RedHat 6.5?

text: My servers are hosted at Hetzner and I need to create a point-to-point connection to my gateway. The server can only reach its gateway (and its locally configured) IP addresses directly. All other packets need to be routed via the default gateway. Consequently, a /32 network needs to be set up (for reasons of network security). Hetzner's wiki-article: http://wiki.hetzner.de/index.php/Netzkonfiguration_CentOS/en#Configuring_a_point- to-point_connection Hereunder my file /etc/sysconfig/network-scripts/ifcfg-eth0               DEVICE=eth0     HWADDR=00:1E:45:ZZ:34:F9     ONBOOT=yes     BOOTPROTO=static     IPADDR=192.168.1.1     NETMASK=255.255.255.255      Hereunder my /etc/sysconfig/network-scripts/route-eth0 file               ADDRESS0=0.0.0.0     NETMASK0=0.0.0.0     GATEWAY0=192.168.1.254      I restart the network: service network restart An error appears: "RTNETLINK answers: No such Process". The output of command "route":               link-local * 255.255.0.0 U 1002 0 0 eth0      After some search, I edit the file /etc/sysconfig/network as below:               NETWORKING=YES     HOSTNAME=server.domain.lan     GATEWAYDEV=eth0      An error appears: "RTNETLINK answers: File exists". The output of command "route":               link-local * 255.255.0.0 U 1002 0 0 eth0     default    * 0.0.0.0     U 0    0 0 eth0      Ping to the default gateway was OK. Ping to the outside was NOK ! The only way to succeed was to manually add a "second" default route: route add default gw 192.168.1.254 eth0 The output of command "route":               link-local *               255.255.0.0 U  1002 0 0 eth0     default    *               0.0.0.0     U  0    0 0 eth0     default    static.254.1.16 0.0.0.0     UG 0    0 0 eth0      In fact, the file route-eth0 is not needed. If I delete it, no more error during the restart. How could you explain that ? Is there another way to succeed ? Is this method correct ? The problem is that when I'm disconnecting/reconnecting the network interface, the route is not automatically added... Thanks,


title: Wi-Fi with WEP from command line in Ubuntu 12.04, Kernel 3.8.0-29-generic

text: I have removed `network-manager` and am trying to configure Wi-Fi with WEP manually. I am running on an `X1 Carbon`. Here are the commands I am running:               ifconfig wlan0 down     iwconfig wlan0 essid "<MYSSID>"     iwconfig wlan0 key <WEP Key (hex digits>     ifconfig wlan0 up     dhclient -v wlan0      The output of `dhclient -v` is a stream of               DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 3       DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 5      Here is the output of `dmesg | tail` (mac address removed)               [  739.160769] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready     [  742.280433] wlan0: authenticate with <router_mac_address>     [  742.288117] wlan0: send auth to <router_mac_address> (try 1/3)     [  742.290519] wlan0: authenticated     [  742.290615] iwlwifi 0000:03:00.0 wlan0: disabling HT/VHT due to WEP/TKIP use     [  742.290632] wlan0: waiting for beacon from <router_mac_address>     [  742.378124] wlan0: associate with <router_mac_address> (try 1/3)     [  742.581910] wlan0: associate with <router_mac_address> (try 2/3)     [  742.785611] wlan0: associate with <router_mac_address> (try 3/3)     [  742.989382] wlan0: association with <router_mac_address> timed out      Here is the output `modprobe -l | grep iwl`               kernel/drivers/net/wireless/iwlwifi/iwlwifi.ko     kernel/drivers/net/wireless/iwlwifi/dvm/iwldvm.ko     kernel/drivers/net/wireless/iwlegacy/iwlegacy.ko     kernel/drivers/net/wireless/iwlegacy/iwl4965.ko     kernel/drivers/net/wireless/iwlegacy/iwl3945.ko      Please let me know if additional information would help, or if there's some step I'm missing. I have tried the same steps on Ubuntu 13.10, but I get the same result. Update 1: While I am running `dhclient wlan0` in one terminal, I have `tcpdump -i wlan0 -nl` in a different terminal. `tcpdump` does not see a single packet actually go out. Update 2: Here is the output of `lshw -C network`                *-network                           description: Wireless interface            product: Centrino Advanced-N 6205 [Taylor Peak]            vendor: Intel Corporation            physical id: 0            bus info: pci@0000:03:00.0            logical name: wlan0            version: 96            serial: <mac_address>            width: 64 bits            clock: 33MHz            capabilities: pm msi pciexpress bus_master cap_list ethernet physical wireless            configuration: broadcast=yes driver=iwlwifi driverversion=3.11.0-14-generic firmware=18.168.6.1 latency=0 link=no multicast=yes wireless=IEEE 802.11abgn            resources: irq:43 memory:f0c00000-f0c01fff      Also, `iwlist wlan0 scan` works fine.


title: How to pass multiple commands via pssh and multiple xterms

text: I'm attempting to open multiple xterms and run a command as an SAP user via sudo using `pssh`. So far, I'm able to run PSSH to a file of servers with no check for keys, open every xterm in the servers in the file list, and sudo to the SAP (ADM) user, but it won't do anything else afterwards. I've tried many combinations and I'm not sure if my options for the `pssh` nor the xterm options are set correctly. Here is what I have now.               pssh -i -h ectsrv -A -O StrictHostKeyChecking=no "export DISPLAY=IP address:0.0;  xterm -hold -e "sudo /path/sap_sudo.sh" "       I've tried many combinations: with and without single and double quotes:               xterm -e sudo "cmd1;cmd2;ls;bash"     xterm -e sudo "cmd1 && cmd2"     xterm -e sudo "cmd1;cmd2; ksh"     xterm -e sudo "-tt" "cmd1;cmd2;ls;bash"      I'm completely stuck where `SIDADM>` is shown in new windows, but it won't run any commands.


title: How to start up mate desktop

text: We have had Fedora 20 installed on my wife's laptop, and want to use Mate as the default desktop displayed. The machine is set up to require no user password, but at reset there is no gear wheel to choose the desktop. The current desktop (Gnome 3?) does not seem to have access to systems settings that allow the change. Please, how do we go about this. I have happily set up and use Mate on two other machines, desktop (tower) and laptop, but, of course, have forgotten the procedure I used, I don't recall it being difficult. I have done:`# yum groupinstall Mate-desktop` and (I might have this wrong from memory, and have mislaid the reference, but the response is correct) `# yum install @mate-desktop` gives `nothing to do`. Please, no answers suggesting other desktops, we have made the choice.


title: How to safely pass variables to root-enabled scripts?

text: This question is totally general and not only applicable to my situation, but... I have a small busybox appliance where I want a non-root user to be able to execute a particular script with root priviliges. For example, something like this small script to enable DHCP, where the only variable (`$1`) to send in on the cmdline (!!) is what host name to send out:               #!/bin/bash     udhcpc -b -i eth0 -h $1      running udhcpc like this requires root access, so to do this I plan on modifying `/etc/sudoers` to contain this line:               joe ALL = NOPASSWD: /path/to/enable_dhcp.sh      which should enable "joe" to easily run that script with root privileges by simply running:               sudo /path/to/enable_dhcp.sh      and not being asked for a password (which is what I want, since I want joe to be able to script this). Now.. I _know_ (or at least think I do) that using `$1` in a script that can easily be run with root privileges is a HORRIBLE idea since you can inject whatever you want into that. So... what is the best way to deal with this? How do I let joe do what I want with root privileges, allow him to pass in a variable (or effectively do so like with an environment variable), while not being wide open to injection attacks?


title: what jobs are out there for NIX geeks?

text: What kind of job opportunities are out there for people that have extensive experience with *NIX?


title: when timing a command execution time with sudo, `time` should be before `sudo` or after `sudo`?

text: when timing a command execution time with `sudo`, `time` should be before `sudo` or after `sudo`?               time sudo command      or               sudo time command      which one is correct? the output seems very different to me                   [esolve@xxt ~]$ sudo time ls         193.144.21.131_udp.folder  lockfile         run_udp.sh    udp_folder         50IP.txt                   my_ip_host_site  send_udp_log  udp_receiver         ip_each_site               raw_udp_client   ssh.log         0.00user 0.00system 0:00.00elapsed ?%CPU (0avgtext+0avgdata 3088maxresident)k         0inputs+0outputs (0major+236minor)pagefaults 0swaps                   [esolve@xxt ~]$ time sudo ls                 193.144.21.131_udp.folder  lockfile         run_udp.sh    udp_folder         50IP.txt                   my_ip_host_site  send_udp_log  udp_receiver         ip_each_site               raw_udp_client   ssh.log              real    0m0.004s         user    0m0.003s         sys     0m0.002s         [esolve@xxt ~]$      why they are like this?


title: mint 13 xfce: cannot find or make trash bin

text: I have a problem with removing files from some partitions. I get an error: cannot find or make trash bin. I have searched google for this and found a site suggesting the partitions are mounted incorrect. I have tried the suggestion offered there, but this did not help me solve the problem. Can anyone help me solve my issue (and helping me configure my fstab file? my fstab now looks like this (but is not correct):               #XP Systeem partitie     UUID=3280B49280B45DD3 /media/SYSTEEM/ ntfs-3g  defaults,uid=1000,gid=1000,dmask=027,fmask=137,users,exec,noauto,noatime 0 0          #Storage partitie     UUID=5D72C7913FF69127           /media/STORAGE/ ntfs-3g defaults,uid=1000,gid=1000,dmask=027,fmask=137,users,exec,noauto,noatime 0 0          #Multimedia partitie     UUID=79737B2129F73516           /media/MULTIMEDIA/ ntfs-3g    defaults,uid=1000,gid=1000,dmask=027,fmask=137,users,exec,noauto,noatime 0 0          #Video partitie     UUID=01CE758E211FEFB0           /media/VIDEO/ ntfs-3g      defaults,uid=1000,gid=1000,dmask=027,fmask=137,users,exec,noauto,noatime 0 0          #Backup partitie     UUID=01CE758E255A6510           /media/BACKUP/ ntfs-3g  defaults,uid=1000,gid=1000,dmask=027,fmask=137,users,exec,noauto,noatime 0 0      I hope I can solve this with your help.


title: Strange formatting of date in bash script

text: I am working on a script to sort my downloads folder by the date the files were created. This is the script I am using:               #!/bin/bash          cd ~/Downloads     for FILENAME in *     do         if [[ -f $FILENAME ]]; then             date="$(ls -l $FILENAME | tr -s ' ' | cut -d ' ' -f 6 | tr -d '.')"             mkdir -vp "$date"             find . -maxdepth 1 -type f -name $FILENAME -exec mv {} "$date" \;         fi     done     cd -      The name of the folder created by this script is just `Jun` which leads me to believe there is some sort of conversion going on somewhere. If I do just a               ls -l test0 | tr -s ' ' | cut -d ' ' -f 6 | tr -d '.'      the date shows `19062014` correctly. This is the result of a `bash -x` of the script:               sigurd@Goliath ~ -> bash -x clean     + cd /home/sigurd/Downloads     + for FILENAME in '*'     + [[ -f test0 ]]     ++ ls -l test0     ++ tr -s ' '     ++ cut -d ' ' -f 6     ++ tr -d .     + date=Jun     + mkdir -vp Jun     mkdir: created directory 'Jun'     + find . -maxdepth 1 -type f -name test0 -exec mv '{}' Jun ';'     + for FILENAME in '*'     + [[ -f test1 ]]     ++ ls -l test1     ++ tr -s ' '     ++ cut -d ' ' -f 6     ++ tr -d .     + date=Jun     + mkdir -vp Jun     + find . -maxdepth 1 -type f -name test1 -exec mv '{}' Jun ';'     + cd -     /home/sigurd      The functionality I'm looking for is that the script should move files into folders named `19_06_2014`, `20_06_2014` etc. based on when the file was created.


title: Client can't see DNS server on Ubuntu 12.04 Server with two ethernet cards

text: I'm running Ubuntu 12.04 Server with Webmin, bind9, and a GUI. It has two ethernet cards: eth0 coming in, and eth1 to talk to clients. My client gets an IP address from DHCP, but cannot connect because "DNS is not responding" (Windows 7), even though it's detected. I was seeing a lease, but changed something and now I don't see a lease in webmin. **Edit 1** netstat output:               Proto  Recv-Q  Send-Q  Local_Addr        Foreign_Addrs  ST      PID     tcp    0       0       127.0.0.1:3306    0.0.0.0:*      LISTEN  220/mysqld     tcp    0       0       10.0.0.254:53     0.0.0.0:*      LISTEN  9782/named     tcp    0       0       192.168.1.216:53  0.0.0.0:*      LISTEN  9782/named     tcp    0       0       127.0.0.1:53      0.0.0.0:*      LISTEN  9782/named     tcp    0       0       0.0.0.0:22        0.0.0.0:*      LISTEN  9724/sshd     tcp    0       0       127.0.0.1:953     0.0.0.0:*      LISTEN  ???


title: Always look up non-FQDN domains as .example.com?

text: When I connect to the company OpenVPN they don't push their DNS to my computer, which means I have to type the FQDN for the hosts I e.g. SSH and HTTP to. **Question** Is it possible to configure my Linux desktop, so can do               ssh ss@serv      instead of               ssh ss@serv.example.com      ? There is only one domain, so incase the non-FQDN fails, it will always work, if just `example.com` is appended.


title: Can kexec be built to a standalone binary, to be used where kexec was not built into the kernel?

text: I have remote embedded Linux devices I am trying to update to a new kernel without having to physically access. However, the command line options they boot with make one of the MTDs read only - I cannot modify the kernel, and U-Boot is only accessible over a physical, serial connection. kexec support was not installed. I am trying to build kexec myself, but not having any success. I have built the kexec from kexec-tools, but when I attempt to load a kernel, I get:               kexec_load failed: Function not implemented      Is there any way I can salvage this situation? Can kexec be made as a single binary executable? I have seen on forums where people have suggested they were using it this way, but I cannot seem to build it as such. **Edit:**  If making kexec work is not an option, is there any way I can get access to MTD0? I don't have access to one of the devices this second, but there's something like /proc/something/devices/virtual/mtd0/ro, which is 1, and if I chmod 777 it I can echo 0 > to it without any errors, but it doesn't stick.


title: Steps to secure your server?

text: > **Possible Duplicate:**   >  What to use to harden Linux box? Apparmor, SELinux, grsecurity, SMACK, > chroot? I'm just completed install my web server. So what should i do to secure it? I just installed Apache , Nginx , Mysql, Php. Regular Upgrade (yum upgrade) How to prevent of being hack ?


title: What are the new features available to bash 4?

text: I was using bash3 up to now, and just got a copy of the latest version               $ ./bash --version     GNU bash, version 4.1.0(1)-release (i686-pc-linux-gnu)     Copyright (C) 2009 Free Software Foundation, Inc.     License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>          This is free software; you are free to change and redistribute it.     There is NO WARRANTY, to the extent permitted by law.     $      What are the major changes/feature additions in version 4 over version 3?


title: How to make sure that I use the latest version of bash?

text: I just setup bash v4.1.0 on my machine. The old version is under `/bin/bash`. Is there a way to use the newer version of bash without replacing the old one from `/bin`? I want the newer version to be used as the default one               $ which bash     /bin/bash     $ bash --version     GNU bash, version 3.00.15(1)-release (i686-redhat-linux-gnu)     Copyright (C) 2004 Free Software Foundation, Inc.     $ ~/bash/bash-4.1/bash --version     GNU bash, version 4.1.0(1)-release (i686-pc-linux-gnu)     Copyright (C) 2009 Free Software Foundation, Inc.     License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>          This is free software; you are free to change and redistribute it.     There is NO WARRANTY, to the extent permitted by law.     $


title: Solaris 11 nslookup reverses ip

text: From (Solaris 11.1 with current patches, m4000 128GB) syslog:               Jun 17 10:06:14 sun-m4k-03 sendmail[4993]: [ID 702911 mail.warning] gethostbyaddr(10.128.4.50) failed: 1      The ip is valid from the commandline:               ping 10.128.4.50     10.128.4.50 is alive      nslookup appears to reverse the octets when doing a lookup:                nslookup 10.128.4.50     Server:         10.128.8.18     Address:        10.128.8.18#53          ** server can't find 50.4.128.10.in-addr.arpa.: NXDOMAIN      Tried a search on the internet - no luck


title: Symlinks on /dev/ttyUSB* via udev

text: So I built a nice little GSM-Gateway with a PC-Engines ALIX.2D13, a Huawei E220 umts modem, Debian Wheezy and gammu-smsd. I need a fixed device name für gammu-smsd to survive reboots. I tried to make following udev rules, but i can't find out why it doesn't work.               SUBSYSTEM=="tty", ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1003", ATTRS{bInterfaceNumber}=="00", SYMLINK+="gsm0"     SUBSYSTEM=="tty", ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1003", ATTRS{bInterfaceNumber}=="01", SYMLINK+="gsm1"      My udevadm output is the following:               root@ko-smsgw-01:~# udevadm info -a -n /dev/ttyUSB0          Udevadm info starts with the device specified by the devpath and then     walks up the chain of parent devices. It prints for every device     found, all possible attributes in the udev rules key format.     A rule to match, can be composed by the attributes of the device     and the attributes from one single parent device.            looking at device '/devices/pci0000:00/0000:00:0f.4/usb2/2-1/2-1:1.0/ttyUSB0/tty/ttyUSB0':         KERNEL=="ttyUSB0"         SUBSYSTEM=="tty"         DRIVER==""            looking at parent device '/devices/pci0000:00/0000:00:0f.4/usb2/2-1/2-1:1.0/ttyUSB0':         KERNELS=="ttyUSB0"         SUBSYSTEMS=="usb-serial"         DRIVERS=="option1"         ATTRS{port_number}=="0"            looking at parent device '/devices/pci0000:00/0000:00:0f.4/usb2/2-1/2-1:1.0':         KERNELS=="2-1:1.0"         SUBSYSTEMS=="usb"         DRIVERS=="option"         ATTRS{bInterfaceNumber}=="00"         ATTRS{bAlternateSetting}==" 0"         ATTRS{bNumEndpoints}=="03"         ATTRS{bInterfaceClass}=="ff"         ATTRS{bInterfaceSubClass}=="ff"         ATTRS{bInterfaceProtocol}=="ff"         ATTRS{supports_autosuspend}=="1"         ATTRS{interface}=="Data Interface"            looking at parent device '/devices/pci0000:00/0000:00:0f.4/usb2/2-1':         KERNELS=="2-1"         SUBSYSTEMS=="usb"         DRIVERS=="usb"         ATTRS{configuration}==""         ATTRS{bNumInterfaces}==" 3"         ATTRS{bConfigurationValue}=="1"         ATTRS{bmAttributes}=="a0"         ATTRS{bMaxPower}=="500mA"         ATTRS{urbnum}=="1126"         ATTRS{idVendor}=="12d1"         ATTRS{idProduct}=="1003"         ATTRS{bcdDevice}=="0000"         ATTRS{bDeviceClass}=="00"         ATTRS{bDeviceSubClass}=="00"         ATTRS{bDeviceProtocol}=="00"         ATTRS{bNumConfigurations}=="1"         ATTRS{bMaxPacketSize0}=="64"         ATTRS{speed}=="12"         ATTRS{busnum}=="2"         ATTRS{devnum}=="7"         ATTRS{devpath}=="1"         ATTRS{version}==" 1.10"         ATTRS{maxchild}=="0"         ATTRS{quirks}=="0x0"         ATTRS{avoid_reset_quirk}=="0"         ATTRS{authorized}=="1"         ATTRS{manufacturer}=="HUAWEI Technologies"         ATTRS{product}=="HUAWEI Mobile"            looking at parent device '/devices/pci0000:00/0000:00:0f.4/usb2':         KERNELS=="usb2"         SUBSYSTEMS=="usb"         DRIVERS=="usb"         ATTRS{configuration}==""         ATTRS{bNumInterfaces}==" 1"         ATTRS{bConfigurationValue}=="1"         ATTRS{bmAttributes}=="e0"         ATTRS{bMaxPower}=="  0mA"         ATTRS{urbnum}=="180"         ATTRS{idVendor}=="1d6b"         ATTRS{idProduct}=="0001"         ATTRS{bcdDevice}=="0302"         ATTRS{bDeviceClass}=="09"         ATTRS{bDeviceSubClass}=="00"         ATTRS{bDeviceProtocol}=="00"         ATTRS{bNumConfigurations}=="1"         ATTRS{bMaxPacketSize0}=="64"         ATTRS{speed}=="12"         ATTRS{busnum}=="2"         ATTRS{devnum}=="1"         ATTRS{devpath}=="0"         ATTRS{version}==" 1.10"         ATTRS{maxchild}=="4"         ATTRS{quirks}=="0x0"         ATTRS{avoid_reset_quirk}=="0"         ATTRS{authorized}=="1"         ATTRS{manufacturer}=="Linux 3.2.0-4-486 ohci_hcd"         ATTRS{product}=="OHCI Host Controller"         ATTRS{serial}=="0000:00:0f.4"         ATTRS{authorized_default}=="1"            looking at parent device '/devices/pci0000:00/0000:00:0f.4':         KERNELS=="0000:00:0f.4"         SUBSYSTEMS=="pci"         DRIVERS=="ohci_hcd"         ATTRS{vendor}=="0x1022"         ATTRS{device}=="0x2094"         ATTRS{subsystem_vendor}=="0x1022"         ATTRS{subsystem_device}=="0x2094"         ATTRS{class}=="0x0c0310"         ATTRS{irq}=="12"         ATTRS{local_cpus}=="1"         ATTRS{local_cpulist}=="0"         ATTRS{dma_mask_bits}=="32"         ATTRS{consistent_dma_mask_bits}=="32"         ATTRS{enable}=="1"         ATTRS{broken_parity_status}=="0"         ATTRS{msi_bus}==""            looking at parent device '/devices/pci0000:00':         KERNELS=="pci0000:00"         SUBSYSTEMS==""         DRIVERS==""


title: Uninstall Aptana from Ubuntu

text: Can someone please tell me how to uninstall Aptana from ubuntu 12.04 LTS? I followed these instructions, in summary:   1. Install the prerequisites with `apt-get install`.   2. Download Aptana Studio   3. Extract Aptana Studio              sudo unzip [name of Aptana Studio ZIP file here].zip -d /opt        4. Add the menu shortcut              wget http://www.samclarke.com/wp-content/uploads/2012/04/AptanaStudio3.desktop     sudo mv AptanaStudio3.desktop /usr/share/applications/AptanaStudio3.desktop


title: I/O-overhead of dm-encrypted device?

text: What would be the Read-/Write-overhead when using dm-crypt (LUKS) as full disk-encryption (including root partition) on a Linux-Desktop (Ubuntu)? I plan to stack it like so: LUKS > LVM > ext4 The CPU in use on the system would be a Core2 Duo 2.1 GHz with 4GB of RAM.   * Would encryption of such a system create a great/noticeable overhead?    * Are there any recent benchmarks to be found on the net? What is your personal experience?   * Are there any settings I can make to improve performance? Thx for your help.


title: How to permanently remove all Mono related package (libs, apps, etc.)

text: I'm a Ubuntu newbie. In my opinion Mono is a patent trap and I do not want my distribution of choice to be tainted by anything Mono or any application that requires Mono. So I would welcome your feedback for the following:   1. How to prevent anything Mono and applications that require Mono from getting installed in the first place. Is there a way to forcefully disable Mono during installation?   2. How do I find out if I have anything Mono installed on my current default installation?   3. If Mono is already installed, how to remove Mono and all applications that require Mono? Hopefully with your feedback I can make sure that all my bits are truly free.


title: How does APT deal with different programs with the same name?

text: I decided to finally learn vi and as I was doing that I realized that vi wasn't behaving as I expected. I learned from another post that this was because, on Ubuntu, vim-tiny is installed by default. After I learned that I chose to install the full version of vim using the following command:               sudo apt-get install vim      After I did that I became curious about a number of things:   1. I noticed that vi and vim commands are now associated with the full version of vim and not vim-tiny. How does this happen? (i.e. How does the name look-up work?)    2. How do I explicitly execute either vim-tiny or _full_ vim?    3. How does Linux/Ubuntu/apt manage libraries and executables with name clashes? How about different versions? I'm working on Ubuntu Server 12.04 LTS.


title: Find all directories, in which user has access to search and echo this directories in shell

text: I need to find all directories, in which user has access to search(command `find`) and echo this directories in shell. USER is read from ksh. for example:               read user      I know, if user want to use `find` in directory, user should have "read access" and "execute access" for this directory. I should check all directories for `r` and `x` access for inputed user. I'm having a little trouble with this steps. Maybe a simple solution can help me and my algorithm is wrong. Please,help!


title: Encrypted disk filesystem compatibilities

text: On my Debian Linux system during the install I decided to use disk encryption (the one offered during a regulard Debian install). When the system boots up I need to enter a password and then the "real" boot begins. Could someone explain how this encryption is performed? Does it happen before or after the filesystem's laid out? Can I use any filesystem available for Linux with the disk encryption? The _/etc/mtab/_ is more complicated than what I was used with Linux and I take it it's related to disk encryption but I'm really not sure. Here's (what I think is) the relevant bits from my _/etc/mtab_ :               /dev/sda1 /boot ext2 rw,relatime,errors=continue 0      /dev/mapper/archon-root / ext4 rw,noatime,errors=remount-ro,user_xattr,commit=300,barrier=1,data=ordered 0 0     rootfs / rootfs rw 0 0      I don't really understand why /boot is ext2 and why / is ext-4 and using a _/dev/mapper_. Could /boot be itself using ext4? Could / be using, say, ZFS and yet still offer encryption?


title: Linux -> linux remote X login/desktop

text: What are the (best) solutions for remote desktop in linux? Ideally I'd like to be able to be able to log in to a remote X (KDE) session without even logging into my local machine. Maybe if I could have a remote X session forwarded to a different virtual terminal session so I can switch back and forth between local and remote with Ctrl + alt + n? This is going to be over the internet via a VPN, so data-light solutions would be best =]


title: Make find show slash after directories?

text: How can I make the find command show a slash after directories? For example, I want `dir` to show up as `dir/` instead of `dir`. I'm using `find . -print`


title: Adding numbers from the result of a grep

text: I run the following command:               grep -o "[0-9] errors" verification_report_3.txt | awk '{print $1}'      and I get the following result:               1     4     0     8      I'd like to add each of the numbers up to a running count variable. Is there a magic one liner someone can help me build?


title: Running Gst Player through command line

text: > **Possible Duplicate:**   >  Commandline gstreamer player I want to run my Gst Player through command prompt in ubuntu 10.10 please help


title: Delete whitespace in filenames in directory

text: I have a directory where some filenames have been wrongly named `something .pdf` rather than `something.pdf`. Is there a quick one liner I can use to delete the whitespace in the filenames. I have tried `find -name "* .pdf" -type f | rename 's/ //g'` but this did not work.


title: How do I install Adobe Flash on Debian Wheezy?

text: I have tried following http://wiki.debian.org/FlashPlayer but on the very first command:               sudo aptitude install flashplugin-nonfree      I get:               oshirowanen@debian:~$ sudo aptitude install flashplugin-nonfree     [sudo] password for oshirowanen:      No candidate version found for flashplugin-nonfree     No candidate version found for flashplugin-nonfree     No packages will be installed, upgraded, or removed.     0 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded.     Need to get 0 B of archives. After unpacking 0 B will be used.                                   oshirowanen@debian:~$       No idea what I'm doing wrong.


title: Is there a way to store mail attachments outside of mailboxes?

text: Nowadays, size limits on mail attachments are less comprehensible by traditional users. I am looking for a way to extract mail attachments as simple files that I would be able to manage elsewhere. On technical side, I could be able to raise significantly size limits if I were able to store files attached to mail on a dedicated server. I would then be able to clean them after 6 months, for instance. Do you know a way to do this with open source Linux software ?


title: problem with cinnamon 2.0.14 on Linux mint 13

text: I have problem with cinnamon 2.0.14, windows (and even main menu) are blinking and flickering. I have already remove it and reinstalled it but the problem still persists. How can I get rid of blinking and flickering? ` inxi -Gxx Graphics: Card: Intel 2nd Generation Core Processor Family Integrated Graphics Controller bus-ID: 00:02.0 X.org: 1.11.3 driver: vesa tty size: 80x24 Advanced Data: N/A for root `


title: How to add a ms-dos partition table to a loop device?

text: I recently made a dd from a disk partition. I want to use it as a disk in a virtual machine. I can't because the disk has no partition table. Can I had a partition table to a loop device? how? apparently a similar question exists here.  If someone knows how to do this without duplicating all data, that would be great. I did `dd if=/dev/sda1 of=myfile` I can't copy the full sda disk because it's just too big.


title: Explanation of bandwidth management script calling tc

text: I have some scripts in Linux to manage internet bandwidth, but I do not understand what they do. What is the meaning of the following scripts:               tc qdisc add dev $IF root handle 1: htb default 256     tc class add dev $IF parent 1: classid 1:1 htb rate $max      iptables -F     iptables -t nat -F     iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE     #iptables -t nat -A PREROUTING -i eth1 -p tcp --dport 80 -j DNAT --to 192.168.0.1:4001     echo 1 > /proc/sys/net/ipv4/ip_forward      And:               tc class add dev $IF parent 1:1 classid 1:$(($n)) htb rate "$1"kbps ceil "$2"kbps      tc filter add dev $IF protocol ip parent 1:0 prio 2 u32 match ip dst "$line"/32 flowid 1:$(($n))          #ack        tc filter add dev $IF parent 1: protocol ip prio 1 u32 match ip dst "$line"/32 match ip protocol 6 0xff match u8 0x05 0x0f at 0 match u16 0x0000 0xffc0 at 2 match u8 0x10 0xff at 33 flowid 1:$(($n))      And:               tc class add dev $IF parent 1:1 classid 1:256 htb rate 60kbps


title: Did I messed up something by accidentally pasting the '/etc/inittab' into the shell?

text: Help me Unix specialists, We were doing some system checkup and I entered into the shell (ussing PuTTY):   `# more /etc/inittab`.   I copied the contents of the output with intentions to paste all that into a document. But then accidentally I hit the right click, and in putty that means PASTE so i pasted all that back into the shell. Did i messed up something really bad? I am afraid that the system won't boot next time? Im going crazy it's a production system. So far everything seems normal. The `/etc/inittab` is still the same, but I am afraid that I might have messed up something else that will reveal itself later.               # more /etc/inittab     init:3:initdefault:     ioin::sysinit:/sbin/ioinitrc >/dev/console 2>&1     tape::sysinit:/sbin/mtinit > /dev/console 2>&1     muxi::sysinit:/sbin/dasetup   </dev/console >/dev/console 2>&1 # mux init     stty::sysinit:/sbin/stty 9600 clocal icanon echo opost onlcr ixon icrnl ignpar </dev/systty     brc1::bootwait:/sbin/bcheckrc </dev/console >/dev/console 2>&1 # fsck, etc.     link::wait:/sbin/sh -c "/sbin/rm -f /dev/syscon;                        /sbin/ln /dev/systty /dev/syscon" >/dev/console     2>&1     cprt::bootwait:/sbin/cat /etc/copyright >/dev/syscon           # legal req     sqnc::wait:/sbin/rc </dev/console >/dev/console 2>&1           # system init     #powf::powerwait:/sbin/powerfail >/dev/console 2>&1            # powerfail     cons:123456:respawn:/usr/sbin/getty console console            # system console     #ttp1:234:respawn:/usr/sbin/getty -h tty0p1 9600     #ttp2:234:respawn:/usr/sbin/getty -h tty0p2 9600     #ttp3:234:respawn:/usr/sbin/getty -h tty0p3 9600     #ttp4:234:respawn:/usr/sbin/getty -h tty0p4 9600     #ttp5:234:respawn:/usr/sbin/getty -h tty0p5 9600     ems1::bootwait:/sbin/rm -f /etc/opt/resmon/persistence/runlevel4_flag     ems2::bootwait:/sbin/cat </dev/null >/etc/opt/resmon/persistence/reboot_flag     ems3:3456:wait:/sbin/sh -c "/usr/bin/touch /etc/opt/resmon/persistence/runlevel4_flag; /usr/bin/chmod 644 /etc/opt/resmo     n/persistence/runlevel4_flag"     ems4:3456:respawn:/etc/opt/resmon/lbin/p_client     #ups::respawn:rtprio 0 /usr/lbin/ups_mond -f /etc/ups_conf     a0:3:off:/usr/sbin/getty -h ttyd2a1 1200     a1:3:off:/usr/sbin/getty -h ttyd2a2 1200     #      ##      And bellow is the paste:                 # # more /etc/inittab     init:3:initdefault:     # init:3:initdefault:     stty::sysinit:/sbin/stty 9600 clocal icanon echo opost onlcr ixon icrnl ignpar </dev/systty     brc1::bootwait:/sbin/bcheckrc </dev/console >/dev/console 2>&1 # fsck, etc.     link::wait:/sbin/sh -c "/sbin/rm -f /dev/syscon;                        /sbin/ln /dev/systty /dev/syscon" >/dev/console     2>&1     cprt::bootwait:/sbin/cat /etc/copyright >/dev/syscon           # legal req     sqnc::wait:/sbin/rc </dev/console >/dev/console 2>&1           # system init     #powf::powerwait:/sbin/powerfail >/dev/console 2>&1            # powerfail     cons:123456:respawn:/usr/sbin/getty console console            # system console     #ttp1:234:respawn:/usr/sbin/getty -h tty0p1 9600     #ttp2:234:respawn:/usr/sbin/getty -h tty0p2 9600     #ttp3:234:respawn:/usr/sbin/getty -h tty0p3 9600     #ttp4:234:respawn:/usr/sbin/getty -h tty0p4 9600     #ttp5:234:respawn:/usr/sbin/getty -h tty0p5 9600     ems1::bootwait:/sbin/rm -f /etc/opt/resmon/persistence/runlevel4_flag     ems2::bootwait:/sbin/cat </dev/null >/etc/opt/resmon/persistence/reboot_flag     ems3:3456:wait:/sbin/sh -c "/usr/bin/touch /etc/opt/resmon/persistence/runlevel4_flag; /usr/bin/chmod 644 /etc/opt/resmo     n/persistence/runlevel4_flag"     ems4:3456:respawn:/etc/opt/resmon/lbin/p_client     #ups::respawn:rtprio 0 /usr/lbin/ups_mond -f /etc/ups_conf     a0:3:off:/usr/sbin/getty -h ttyd2a1 1200     a1:3:off:/usr/sbin/getty -h ttyd2a2 1200     sh: init:3:initdefault::  not found.     # ioin::sysinit:/sbin/ioinitrc >/dev/console 2>&1     # tape::sysinit:/sbin/mtinit > /dev/console 2>&1     # muxi::sysinit:/sbin/dasetup   </dev/console >/dev/console 2>&1 # mux init     # stty::sysinit:/sbin/stty 9600 clocal icanon echo opost onlcr ixon icrnl ignpar </dev/systty     sh: stty::sysinit:/sbin/stty:  not found.     # brc1::bootwait:/sbin/bcheckrc </dev/console >/dev/console 2>&1 # fsck, etc.     #               /sbin/ln /dev/systty /dev/syscon" >/dev/console                                                      <     sh: link::wait:/sbin/sh:  not found.     # 2>&1     # cprt::bootwait:/sbin/cat /etc/copyright >/dev/syscon           # legal req     sh: cprt::bootwait:/sbin/cat:  not found.     # sqnc::wait:/sbin/rc </dev/console >/dev/console 2>&1           # system init     # #powf::powerwait:/sbin/powerfail >/dev/console 2>&1            # powerfail     # cons:123456:respawn:/usr/sbin/getty console console            # system console     sh: cons:123456:respawn:/usr/sbin/getty:  not found.     # #ttp1:234:respawn:/usr/sbin/getty -h tty0p1 9600     # #ttp2:234:respawn:/usr/sbin/getty -h tty0p2 9600     # #ttp3:234:respawn:/usr/sbin/getty -h tty0p3 9600     # #ttp4:234:respawn:/usr/sbin/getty -h tty0p4 9600     # #ttp5:234:respawn:/usr/sbin/getty -h tty0p5 9600     # ems1::bootwait:/sbin/rm -f /etc/opt/resmon/persistence/runlevel4_flag     sh: ems1::bootwait:/sbin/rm:  not found.     # ems2::bootwait:/sbin/cat </dev/null >/etc/opt/resmon/persistence/reboot_flag     sh: ems2::bootwait:/sbin/cat:  not found.     # /persistence/runlevel4_flag; /usr/bin/chmod 644 /etc/opt/resmo                                                     <     > n/persistence/runlevel4_flag"     sh: ems3:3456:wait:/sbin/sh:  not found.     # ems4:3456:respawn:/etc/opt/resmon/lbin/p_client     sh: ems4:3456:respawn:/etc/opt/resmon/lbin/p_client:  not found.     # #ups::respawn:rtprio 0 /usr/lbin/ups_mond -f /etc/ups_conf     # a0:3:off:/usr/sbin/getty -h ttyd2a1 1200     sh: a0:3:off:/usr/sbin/getty:  not found.     # a1:3:off:/usr/sbin/getty -h ttyd2a2 1200     sh: a1:3:off:/usr/sbin/getty:  not found.     #


title: Displaying stdout of a background process in specific location of the terminal

text: I have a command that I run every time a new terminal is opened or a new login is made. This program produces output (colored) which should be positioned before the command prompt. It can take a few seconds to run which will prevent me from using the terminal until then (unless ran in background). Given than zsh has some advanced ways of redrawing the terminal without clobbering existing text, I would like to know how can I run this command in a way that I don't have to wait for it to finish before I can use the terminal but that once it finishes it prints the output as if it was not backgrounded in the first place. In practice I would like something that could do:               Command output:     ... (running on background)     me@computer: somecommand     me@computer: someothercommand      and once the command finishes I would get:               Command output:      * Output foo      * Multiple lines bar      * and some yada     me@computer: somecommand     me@computer: someothercommand      I tried putting the process in background at start but then it does not display the output cleanly. I get something like:               Command output:     [2] 32207     me@computer: somecommand     me@computer: someother * Output foo      * Multiple lines bar      * and some yada     [2]  + done       command     me@computer: someothercommand      So, is this possible? If not with zsh is there any solution out there that could do it? Any pointers or information is welcome.


Is there a pager that stops on form feeds? When I'm reading RFCs, I can read them like this:               $ less -z57 rfc748.txt      This will keep the pager lined up with the pages, but this is a bit of a hack, and when I do a search I'd prefer it to line up the screen with the page boundaries. The page boundaries are marked with form feeds.


title: SSH tunneling error: "channel 1: open failed: administratively prohibited: open failed"

text: When I open this ssh tunnel:               ssh -nXNT -p 22 localhost -L 0.0.0.0:8984:remote:8983      I get this error when trying to access the HTTP server running on localhost:8984:               channel 1: open failed: administratively prohibited: open failed      What does this error mean, and on which machine can you fix the problem?


title: How to increase an FS using a LiveCD - that has SW RAID+LVM

text: If we have an older OS and can only increase the FS if we umount the FS because it is the ex.: /usr - then we have to use a LiveCD. The /usr is in the rootvg (LVM) that is on a SW raid **Q:** What are the steps after booting in a LiveCD to increase the LV then the FS ex.: by 1 GByte? (of course data gathering can be done on the running system before using the LiveCD) UPDATE: the VolumeGroup has free space! So the SW doesn't need to be increased.


title: List partition labels from the command line

text: Is there a command that will list all partitions along with their labels? `sudo fdisk -l` and `sudo parted -l` don't show labels by default. EDIT: (as per comment below) I'm talking about ext2 labels - those that you can set in `gparted` upon partitioning. EDIT2: The intent is to list _unmounted_ partitions (so I know which one to mount).


title: Linux: difference between using autofs with NFS and just using fstab

text: What is the difference between using auto.master and having autofs automount your NFS mountpoints versus just putting the info in fstab? Linux Red-Hat 5/6


title: X hangs after hibernating Fedora 18

text: Yesterday I was using my FC18, of which I haven't updated significant packages for long time, maybe just a few desktop apps some weeks ago. On shutdown I chose to hibernate it, as I usually do and as I have been doing for months almost daily. Today I turned it on just to have X hanging after boot. I tried hard reboot, passing the `noresume` option to grub so that it didn't use the booting data on swap, summoning a login screen and then shutting down by command-line, etc... Nothing changes. Everything loads, even wpa-supplicant, gdm..., at least according to the messages displayed on boot, and then I still end up stuck on a default wallpaper with my working mouse pointer. On the second time I tried rebooting a graphical message, with a sad-faced computer, appeared saying "It seems an error occurred, contact administrator." If I try to start X again on another login screen via `startx` it still hangs. I have made no recent changes to X or system's configuration, nor any important update. The only thing I did differently from usual was hibernating while having some more videos running: a video file played on VLC and some Firefox tabs with flash videos, which, however, were not playing all together at the same time. I usually hibernate after having closed a few apps, that's it. Do you have any idea on what's going on? what should I check to fix the problem?


title: Unable to install SciPy

text: I need to use the module skimage, which calls the module SciPy (I need to find contours)               import numpy     from sys import argv     from PIL import Image     from skimage import measure          # Inicialization     spritesToFind = argv[1]     spriteSize = argv[2]     sheet = Image.open(argv[3])     sheet.verify()          # To grayscale, so contour finding is awesome     grayscale = sheet.convert('L')          # Let numpy do the heavy lifting for converting pixels to pure black or white     data = np.asarray(grayscale).copy()          # Find the contours we need     contours = measure.find_contours(r_grey, 0.8)          # Now we put it back in PIL land     sprite = Image.fromarray(data)     sprite.save(str(Counter), "PNG")      I set upon an epic 5 hour journey to figure out to how solve the problem which is:               Traceback (most recent call last):      File "algo.py", line 4, in <module>     from skimage import measure      File "/usr/local/lib/python2.7/dist-packages/scikit_image-0.9.3-py2.7-linux-i686.egg/skimage/measure/__init__.py", line 3, in <module>     from ._regionprops import regionprops, perimeter      File "/usr/local/lib/python2.7/dist-packages/scikit_image-0.9.3-py2.7-linux-i686.egg/skimage/measure/_regionprops.py", line 5, in <module>     from scipy import ndimage     ImportError: No module named scipy      So I figured I had to install SciPy. I began with `pip` and `easy_install`, couldn't get the thing to work. I downloaded both numpy and scipy tarballs and configured them, but scipy required libraries, which I had, just newer versions, but it didnt want them, even though I pointed them at it. Next thing I needed was gfortran, which I couldn't install because none of the libraries would work( there is a link of gfortran on linuxmint.community but you can't reach it because atpurl sais the package is virtual ). I tryed everything. Can you give me some help? All I want is SciPy to work. SciPy:               Blas (http://www.netlib.org/blas/) libraries not found.     Directories to search for the libraries can be specified in the     numpy/distutils/site.cfg file (section [blas]) or by setting     the BLAS environment variable.


title: Building a binary image from U-Boot tools

text: How to build binary image from u-boot tools, for a particular BlackFin processor in the Linux host machine?


title: How to change swap partition from primary to logical?

text: I was installing Mint on dual boot with Win8 and I accidentally created primary swap partition. Is there any way I can change the partition type from primary to logical? Or do I have to delete those partitions and reinstall Mint?


title: Firewall distro to share bandwidth evenly between connected users

text: I'll first describe my situation. I have a network made by a central x86 server/firewall, 5 access points and 2 unmanaged routers in between. 20 Mbits download and 1 Mbit upload ADSL.   Upload is particularly problematic as a single user uploading an email attachment can slow down the whole network to a crawl. What I need is some way to divide the upload speed evenly between the connected devices. It would be nice if it adjusted itself automatically, so that   * 5 connected users -> each get 1/5 of the upload bandwidth   * 10 connected users -> each get 1/10 of the upload bandwidth What I'd like:   * an x86 server distro capable of splitting available bandwidth evenly between connected users   * a GUI tool would be would be perfect What I'd like to avoid:   * traffic priority based on ports (it's not what I'm aiming for)   * programs to install on each device (I cannot do that) Remember traffic is coming in from access points, I don't know if they need some special software too in order for this to work. I'd like to just act on the server, if possible.


title: forward vs. backward symlinks: administrative practice?

text: I'm wondering how other people feel about forward symlinks: are they safe? Good practice? Depends? The reason I ask is that apparently in the linux desktop world, there seems to be a push by various distros to combine /usr/bin with /bin. I've asked why but haven't gotten any great answers other than being able to do an "exec" call to load programs and not have to search PATH (which, to me, seems a rather inconsequential thing to do). So they don't want to search path and always use /usr/bin/ -- ok, why not just put symlinks in /usr/bin pointing back to /bin? (FWIW, it's not just "bin", but also sbin, lib and lib64). Instead of using backlinks, my current current distro has chosen to move binaries off of the root partition onto/into /usr and, as they move files from /[s]bin and the libs to /usr/[s]bin, they are putting forward-links from the root-based dirs to the files in /usr. I have gotten no reasons, at all, for why they decided to move things from the root partition to /usr, but I thought it was common sense, in the case of critical files (like those needed for boot), to never use links to a file- system that might not be mounted by the time you can reference the symlinks. I.e. links in /usr to root are safe because you can't mount /usr if you don't have a root! But the other way around... moer than once I've restored /usr from backup or hand-fixed some problem solely from the rootfs. Am I being overly conservative or are forward link now considered to be in the realm of 'good practice' for critical files??


title: usb0 -> what exactly is it for?

text: So far, I found out that on GNU/Linux `/media/usb0` seems to be a mount point for Ethernet over USB. Nice. **Question** : _Where is defined, what`usb0` is exactly for?_ I distilled the above mentioned suspicion from a lot of discussions where `usb0`is mentioned for Ethernet over USB. But I can't find any definition. Is there a history behind this? * * * **EDIT** : I found the following in FHS 2.3 definitions, section `/media`: > On systems where more than one device exists for mounting a certain type of > media, mount directories can be created by appending a digit to the name of > those available above starting with '0', but the unqualified name must also > exist. so the **[updated/additional] question** : _Is`usb0` meant for Ethernet over USB or is it just commonly used for this?_


title: How can I force sed to continue parsing when it hits an "invalid" character?

text: I have a big playlist in `.pls` format (created with `deadbeef` playing software) which also contains some badly-encoded strings. Whether this is a bug in `deadbeef` or one of its plugins does not really interest me, though, since I just want to cut off from a certain position to the end of the line using `sed`. However, this is easier than it looks at first sight, since `sed` will instantly **interrupt** parsing once it hits a character it deems "invalid":               $ cat archives.pls | grep --perl-regexp Lika.*rar.*02     rar:///home/andy/audio_compressed/world/ru/Lika Star - Ya (RUS 2001).rar:2001- �/02 ���.mp3      This is the original line, unmodified. Now let's try `sed` on it, to extract the path (note: this is for a script I'm almost finished with to check for "dead" audio files in the directory tree, i. e. those that do no longer exist)                $ cat archives.pls | grep --perl-regexp Lika.*rar.*02 | sed -e 's/^\(zip\|rar\|7z\):\/\///' -e 's/\(\.\(zip\|rar\|7z\)\):.*/\1/'      /home/andy/audio_compressed/world/ru/Lika Star - Ya (RUS 2001).rar�/02 ���.mp3      Ugh. This obviously did not work, though the regular expression **is** definitely correct (since it can be proved to work fine with so-called "valid" characters). The `rar�` actually comes from a contraction of originally `rar:2001- �`, which indicates that `sed` parsed from the colon via the "2001-" to the blank, then stopped abruptly at the invalid � character. Still, there is the question left why doesn't `sed` just ignore what encoding it is and parses anyway? I mean, we want everything to be cut off after the colon following the "rar", so it ought to be safe to assume that `.*` _does_ definitely stand for _any_ character? _NOTE: Please refrain from "seemingly elegant" solutions using`cut` in your answers. Been there, done that. Instead, you had better consider that we're on a UNIX-type OS and we may even legitimately use strange file names that involve artists that originally spell ":wumpscut:" or the like. In other words, there might be a colon something in-between as well, which is why it would not be a good idea to statically cut off at the first colon we come across after the `(zip|rar|7z)://`._


title: How do I prevent the screen from blanking?

text: I am running 12.04 Ubuntu Server and my screen blanks after some time. I am unable to unblank it without power cycling the computer. I can however log in via `ssh` and type who see that the `tty1` terminal is active. I have asked this question here twice before and have accepted the solutions that worked at that time.   * using `console-tools`   * editing `/etc/kbd/config` These no longer work. How do I prevent Ubuntu Server from blanking the screen? Or at least unblank it without a power cycle? I am not using X.


title: Why is UID information not in /proc/X/stat?

text: This is a silly question for the sake of academics; I know where to get the `UID` information if I need it. According to the proc(5) man page:                      /proc/[number]/stat                   Status information about the process.  This is used by ps(1).  It is defined in /usr/src/linux/fs/proc/array.c.                 /proc/[number]/statm                   Provides information about memory status in pages.  The columns are:                 /proc/[number]/status                   Provides much of the information in /proc/[number]/stat and /proc/[number]/statm in a format that’s easier for humans to parse.      I find it interesting that `stat` doesn't contain information about the `UID`, `EUID`, etc. of a process, yet `status` does. Kind of odd that one is forced to use the "human readable" file instead. Does anyone happen to know the reason for this off-hand?