Installing a light table(editor) in debian

I want to install lighttable programming editor in kali Linux(debian).I have downloaded the `tar.gz` version from here. But I am unable to install the light table .Please help in regarding this.   `./ltbin: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.14' not found (required by ./ltbin) ./ltbin: /lib/x86_64-linux-gnu/libc.so.6: version`GLIBC_2.15' not found (required by ./ltbin)`


Why bash time is more precise then GNU time?

The buitin bash command `time` gives milisecond precision of execution and GNU `time` (usually /usr/bin/time) gives centisecond precision. The `times(2)` syscall gives times in clocks, and 100 clocks = 1 second (usually), so the precision is like GNU `time`. So the question is what is bash `time` using so that it's more precise?


NICE a process and set it to RT

I have a Fedora system with sopcast running two streams. When I watch the stream locally it looks perfectly. But after being processed through my Fedora-box its a bit choppy. I want to set the streams to realtime and prioritize it over everything. As you can see below I've tried setting it to NICE -20 and the other consuming processes to something higher. It seems like it got worse after. How do I make it realtime? Could it be better after setting it for RT? The user running my streams is operate. And everything running on my init 5 + root should be prioritized lowest.               top - 02:09:54 up  1:25,  3 users,  load average: 0.11, 0.10, 0.09     Tasks: 185 total,   2 running, 183 sleeping,   0 stopped,   0 zombie     Cpu(s):  0.3%us,  0.9%sy,  1.2%ni, 96.7%id,  0.4%wa,  0.2%hi,  0.2%si,  0.0%st     Mem:   5914932k total,  2456904k used,  3458028k free,    68296k buffers     Swap:  8028156k total,        0k used,  8028156k free,  1557048k cached            PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                  3775 deluge    39  19  572m  42m  10m S  3.0  0.7   0:50.89 deluged                  1826 root      20   0  148m  20m 8544 S  1.0  0.4   0:21.69 Xorg                     2436 administ  25   5  225m 2520 1764 S  1.0  0.0   0:07.44 synergyc                 1716 operate    0 -20 19596 8244 1884 S  0.7  0.1   0:40.56 sp-so-auth               2367 administ  25   5  572m  15m 9.8m S  0.7  0.3   0:04.47 gnome-terminal             24 root      RT   0     0    0    0 S  0.3  0.0   0:00.24 migration/3               824 deluge    39  19  245m  30m 4236 S  0.3  0.5   0:16.45 deluge            Any other sugestions for getting the stream better? Doesn't seem like the processor is struggling processing it, but still. Deluge seems like it takes quite a lot. That one should be NICED positive? Edit: As a sidenote. My internet-connection is not maxing out. I'm running a BW monitor on the router (DD-WRT). And it shows a upload average of 2Mbit out of 10 Mbit and an average of 0,4 download out of 100Mbit. But the graph itself is behaving really strange. See attached picture. I've been wondering what this could be. Also talked with my provider about MTU and such, but they told everything looked good. As you can see, it's acting strange kind of falling down every other second. Almost as if it hits an maximum window-sizing somewhere. The streams are RTP / HTTP based and is in total 350Kbits + 20Kbits sound. ![Bandwidth monitor graph](http://i.stack.imgur.com/cri3u.png)


System boots only with CD inserted

I have a weird problem lately: My system only boots if either a CD is inserted (any CD, not a specific CD(*)) or if I enter UEFI-BIOS before boot. Otherwise, `grub2` would start but afterwards the screen stays black. The last thing I did before this problem occured (at least I think this was the last thing) was adding partitions on `/dev/sdb` and `/dev/sdc`, generating a raid-1 out of these two partitions and adding the RAID to `/etc/mdadm/mdadm.conf` and `/etc/fstab`. My boot-device however is `/dev/sda` (I have a EFI-partition on `/dev/sda1`) If that helps: I run Debian Wheezy (but also have some packages from experimental). How can I locate the error and solve it? (*) I tried the following CDs:   1. A Debian Wheezy Live DVD (actually a DVD, not a CD) => System booted   2. A Mini CD which came with my WiFi-Router (so to say a driver CD) => System booted   3. Another driver CD that came with my printer ages ago => System booted   4. A music CD (Vive la Fête - République Populaire, but I'm quite convinced that doesn't matter) => System _didn't_ boot It looks like all data CDs work... [edit] here's my dmesg file (with inserted CD)   http://pastebin.com/cxvv0Hqe   maybe that helps!?


Korn Shell: End, pgup, pgdown, and delete key not working

So basically my `End`, `Pageup`/`Pagedown`, and `Delete` key are not working in ksh93. I'm running FreeBSD by the way. My arrow keys are working, and so is my home key. Those keys work when I put this in my `.kshrc`               set -o emacs      I have tried doing THIS, by putting this in my `.kshrc`. To make the `End` key work.               alias __Y=`echo "\005"`     # end = ^e = end of line      I opened up vim, and pressed `Ctrl``v`, and typed `0``0``5`. And the `^E` showed up. Still, nothing worked. Anyone know anyway to get those key to work? Also, When ever I press those keys it prints out a `~`. I also know that I could use `Ctrl``d`, or `Ctrl``a`, I do NOT want to use these.


How can I stop my Linux machine from broadcasting its name on the network?

I have a Linksys router and I've noticed that when I look for connected PC's on the router, the name of my computer and MAC address of the wireless device appears. However, I've noticed that for some devices it appears only the device MAC address, without a name. For example, Apple computers connected to the router appear without a name. The PlayStation 3 and the printer appears without a name too. So my question is, how can I stop my PC with Linux from broadcasting its name so the router can only present its MAC address and not the name? I really don't have any share utility so I don't see any use for broadcasting my PC name.


How can i specify directory user & group for files inside an RPM?

I am building RPMs using FPM. When using the --rpm-user and --rpm-group, I notice as advertised that in the specfile that the %defattr(-,user,group,-) is set under %files. This does indeed set the user and group settings of files, but how do i set the directory user & group?


Can I have my shell history record how wildcards expanded?

If I run:               $ ls *     foo bar buzz     $ history | tail -1     ls *      You can see that in my shell history it remembers that I ran `ls *` rather than `ls foo bar buzz`. Ideally, I'd like to record both in separate histories. When I wonder, "what the heck happened to file foo?", it would be nice to be able to have a way to go back and figure out that I did `rm *` in the wrong directory by searching through my history and finding 'foo'. I'm interested in solutions for both zsh and bash.


echo of a string with an exclamation point

Here are what I put in bash and the results I got about 'echo':               $ echo '!$'        !$       $ echo "!$"       echo "'!$'"       '!$'      I'd like to know how 'echo' deals with the second input. It seems to me that 'echo' would first print the strings (expand some if necessary) you entered, then execute certain if they are executable. A more mind-blowing example I can construct but am not able to understand is:               $ echo '!$'       !$       $ echo "!echo "!$""       echo "echo '!$' "'!$'""       echo '!$' !$


Use a different shell by default in each terminal emulator

I would like to change the default shell in each terminal emulator separately. To clarify, I want Xterm to use TCSH, pterm to use pysh, gnome-terminal to use BASH, etc. Is this possible? If so, how can this be accomplished.


Troubleshooting span traffic shutdown interface?

I'm using guardium appilance, which has one of its port used to analyze span traffic. The base os is linux. The span traffic stopped coming during some time of operations. I asked the network team, and was told that port was shut down on the guardium device end. I'm convinced that this activity has taken on switch level as it was unable to handle the traffic being passed through it. Is there a command that i can run on the linux o/s that would tell exactly if the interface was shutdown ; if yes for what reason? Thanks.


Loop over multiple addresses: ping and drop data into file

I would like to be able to have a script that will:   1. look at a list of IP addresses    2. Ping one of the addresses   3. Take the data and drop it in to a file   4. Move on to the next IP So far I have:               cd /Path/to/addressees || exit 1     for targethost in a b c; do       {ping {targethost}           echo $'\n'"finished:       } >"$log_file" 2>&1     done      When I run this I receive the errors:               ./ping_address: line 3: cd: /path/to/ip_adress: No such file or directory     ./ping_address: line 7: unexpected EOF while looking for matching `"'     ./ping_address: line 8: syntax error: unexpected end of file      I am still a little new to scripting on Unix so any help would be really helpful!


Can ps display only non kernel processes on Linux?

How can I ask `ps` to display only user processes and not kernel threads? See this question to see what I mean...


Simple Shell script to log disk space

I'm working on automating collecting disk space on a group of servers. In a standard terminal, if I run:               ssh server1 ssh server2 df -h       Then I get the output of the command, just fine. However, if I attempt this method from within a script using a For Loop. Then it fails. Example Script:               #!/bin/bash          GROUP="server1 server2"          for s in $GROUP; do          ssh bastion1 ssh ${s} df -h     done      In the latter example, I get no output (or errors for that matter). I've tried various escaping and quoting, but still no luck...I have a feeling it's something blatantly obvious that I am overlooking. Any pointers?


Archlinux: No binaries can be executed

Yesterday I ran an archlinux system upgrade which updated a lot of things, one of them being glibc. Here's a screenshot. Obviously the upgrade of glibc failed. But as you can see on the bottom I cannot execute anything anymore. The files themselves are still there, which i can see using `echo /usr/bin/*` Since I cannot run anything on the machine: is there any way to fix this? Or am I forced to re-install the whole OS?


How to properly disable Gnome 3 shell in Debian?

I just did a Debian install on an old laptop, and I don't need Gnome shell on it. I did it with `apt-get remove gnome-shell`, and it worked after I restarted. However, later I did `apt-get autoremove`, and I was a bit tired and didn't read any of the package names it listed - turned out it removed a whole bunch of important packages from my system, forcing me to re-install Debian from scratch. Is there another way to disable Gnome shell as the default? I tried the following command from the Debian wiki, but it didn't work:               $ gconftool -s /desktop/gnome/session/required_components/windowmanager \            -t string metacity


Map Control-Shift-Tab in rxvt-unicode

I'd like to map the keybinding `Ctrl`+`Shift`+`Tab` in `rxvt-unicode`. I managed to map `Ctrl`+`Tab` as follows. The corresponding entry in `.Xresources` is               URxvt.keysym.Control-Tab: \033[27;5;9~      Using `cat -v` confirms that this mapping works:               $ cat -v     ^[[27;5;9~      The sequence `^[[27;5;9~` can then be used in applications like `vim` for mapping `Ctrl`+`Tab`. I would expect the following `.Xresources` entry to work the same.               URxvt.keysym.Control-Shift-Tab: \033[27;6;9~      However, `cat` does not show the correct mapping:               $ cat -v     ^[[Z      How to set up the `Ctrl`+`Shift`+`Tab` mapping? **Edit** The mappings               URxvt.keysym.Control-ISO_Left_Tab: \033[27;6;9~         URxvt.keysym.Control-Shift-ISO_Left_Tab: \033[27;6;9~      behave the same. After first pressing `Ctrl`+`Tab`, releasing both and then pressing `Return` _twice_ and then pressing `Ctrl`+`Shift`+`Tab`, releasing all and then pressing `Return` _twice_ I get the following output:               $ cat -v     ^[[27;5;9~     ^[[27;5;9~               ^[[27;6;9~↵     ^[[27;6;9~M-bM-^FM-5        * Case `Ctrl`+`Tab`: The first return makes the input appear again as output.   * Case `Ctrl`+`Shift`+`Tab`: The first return produces the sign `↵`, the second return produces the last line shown above. **Next edit: More information** > What happens if you press ctrl-shift (release both without pressing any > keys), then enter, in a different window? In a different urxvt window? When I press Ctrl+Shift and release both keys a strident yellow box appears in the lower left corner: `KEYCAP PICTURE INSERT MODE` it seems to come from urxvt, it does not appear in other applications. > Or even just ctrl-shift-tab then enter in a different window (i mean not > rxvt, like in a gedit window or the web browser or something.) I get a new line. > What happens if you press shift+ctrl+tab [i.e. shift down, ctrl down, tab, > ctrl up, shift up] instead, or vice versa if that was what you were doing? In urxvt?               $ cat -v     shift+ctrl+tab then enter: ^[[27;6;9~     ctrl+shift+down: ↓     ctrl+shift+up: ↑     shift+down: ^[[b     shift+up: ^[[a     ctrl+down: ^[Ob     ctrl+up: ^[Oa     tab: |       | (tab)      > I'm trying to narrow down things because I think you might have some sort of > mapping on "ctrl+shift" in xcompose or something. Not that I'm aware of, but you never know. > What is the output of xev when you press "ctrl+shift+tab, enter"?               KeyPress event, serial 32, synthetic NO, window 0x4800001,         root 0xb4, subw 0x0, time 311734869, (567,395), root:(567,411),         state 0x0, keycode 66 (keysym 0xffe3, Control_L), same_screen YES,         XLookupString gives 0 bytes:          XmbLookupString gives 0 bytes:          XFilterEvent returns: False          KeyPress event, serial 35, synthetic NO, window 0x4800001,         root 0xb4, subw 0x0, time 311734971, (567,395), root:(567,411),         state 0x4, keycode 62 (keysym 0xffe2, Shift_R), same_screen YES,         XLookupString gives 0 bytes:          XmbLookupString gives 0 bytes:          XFilterEvent returns: False          KeyPress event, serial 35, synthetic NO, window 0x4800001,         root 0xb4, subw 0x0, time 311736110, (567,395), root:(567,411),         state 0x5, keycode 23 (keysym 0xfe20, ISO_Left_Tab), same_screen YES,         XLookupString gives 0 bytes:          XmbLookupString gives 0 bytes:          XFilterEvent returns: False          KeyRelease event, serial 35, synthetic NO, window 0x4800001,         root 0xb4, subw 0x0, time 311736494, (567,395), root:(567,411),         state 0x5, keycode 23 (keysym 0xfe20, ISO_Left_Tab), same_screen YES,         XLookupString gives 0 bytes:          XFilterEvent returns: False          KeyRelease event, serial 35, synthetic NO, window 0x4800001,         root 0xb4, subw 0x0, time 311736525, (567,395), root:(567,411),         state 0x5, keycode 62 (keysym 0xffe2, Shift_R), same_screen YES,         XLookupString gives 0 bytes:          XFilterEvent returns: False          KeyRelease event, serial 35, synthetic NO, window 0x4800001,         root 0xb4, subw 0x0, time 311736525, (567,395), root:(567,411),         state 0x4, keycode 66 (keysym 0xffe3, Control_L), same_screen YES,         XLookupString gives 0 bytes:          XFilterEvent returns: False          KeyPress event, serial 35, synthetic NO, window 0x4800001,         root 0xb4, subw 0x0, time 311737530, (567,395), root:(567,411),         state 0x0, keycode 36 (keysym 0xff0d, Return), same_screen YES,     "   XLookupString gives 1 bytes: (0d) "     "   XmbLookupString gives 1 bytes: (0d) "         XFilterEvent returns: False          KeyRelease event, serial 35, synthetic NO, window 0x4800001,         root 0xb4, subw 0x0, time 311737633, (567,395), root:(567,411),         state 0x0, keycode 36 (keysym 0xff0d, Return), same_screen YES,     "   XLookupString gives 1 bytes: (0d) "         XFilterEvent returns: False


changing current working dir with a script

I've read this question and answer, but it doesn't quit fit my problem, even tho it's similar. I'm writing a script (called cpj) that will launch one of my current projects. I have about 5 of them. When I type `$ cpj blah` I want the current working directory to change to the blah project directory (which I hold in $PROJDIR) and I want emacsclient to open the main file for that project (which I hold in $MAINFILE). The question I cited says that you can't directly change the environment of the shell running the script, but you can source a script and it will do so. To test this I wrote a shell script (called chcwd) which has one line: `cd $1` If, from the command line I do: `$ . chcwd $PROJDIR` my current working directory will change as I desire. If, on the other hand, from my cpj script, I have the same line: `. chcwd $PROJECT` it will not change the current working directory of the shell. I realize that I'm running 2 scripts (cpj and then chcwd), and so creating 2 shells, but I see no way to get done what I want. Can anyone show me how to accomplish my goal?


Open a window on a remote X display (why "Cannot open display")?

Once upon a time,               DISPLAY=:0.0 totem /path/to/movie.avi      after ssh 'ing into my desktop from my laptop would cause totem to play `movie.avi` on my desktop. Now it gives the error: > >     No protocol specified >     Cannot open display: >   I reinstalled Debian squeeze when it went stable on both computers, and I guess I broke the config. I've googled on this, and cannot for the life of me figure out what I'm supposed to be doing. (VLC has an HTTP interface that works, but it isn't as convenient as ssh.)


How to start X program on local display?

I'm ssh-ing into a Raspberry Pi. I would like to start an X program remotely, on the Pi's display. I know you can `export DISPLAY` to have programs open up on your computer when you ssh-in. But I'm looking for the opposite. What I'd like to have is have a program open up on the Pi's own (HDMI connected) display, when I run a command from ssh. What I'm looking for is to have a program run on the Pi and display it on the Pi. Pretty much I'd like to just remote control the Pi, using my desktop's keyboard. I'm on Raspbian / Deb Wheezy.


Script executed from cron doesn't display GUI notifications

The script below has the name **notifyrssh.sh**.               1:  File=/home/vaios/Desktop/tempcron/liveusers.txt    //OK     2:  cd /home/vaios/Desktop/tempcron                          3:  ps -aux | grep sshd > liveusers.txt                //OK file is being updated      4:                                                     //   every minute      5:  for name in gus tom max    //***crontab-problem***                              6:  do     7:     notify-send "$name" "DEBUG_MSG"     8:     if grep -q $name "$File"; then     9:             notify-send  "$name" "ONLINE"     10:    fi     11: done      The above script is being run in crontab. I open crontab list with :               crontab -e      And then i add the line :               * * * * * bash /home/vaios/Desktop/tempcron/notifyrssh.sh      **Execution from shell prompt** The script seems to be executing fine when i run it regularly from the shell prompt. Being in the directory where the executable script is, i execute it like this :               ./notifyrssh.sh      ...and it works as i expect (updates the file liveusers.txt and gives me all the notification messages) . I again execute it like this :               bash /home/vaios/Desktop/tempcron/notifyrssh.sh      ...and again the results are correct (update file liveusers.txt etc and gives me the notification messages). **Execution from crontab, every minute** The problem when the script is being executed every minute by crontab begins from **line 5** and onwards until the end. The file **liveusers.txt** is being updated regularly every minute (I check this with : cat liveusers.txt) but then it doesn't give me the notifications i expect. Let me explain what the above script actually does:   * In the first 3 lines it updates the file liveusers.txt with the contents of the command : ps aux | grep sshd   * From line 5 onwards it checks a list of names ( **gus tom max** ) and then if it finds the name in the file liveusers.txt it gives me the notification message from line 9.    * The notification message from line 7 is being put for debugging purposes exclusively. I expected that crontab script will give me at least the notofication from line 7 but that didn't happen also. Any ideas?


Calling xrandr via SSH

> **Possible Duplicate:**   >  Open a window on a remote X display (why "Cannot open display")? I'd like to ssh to a host running an X server and use `xrandr` to query and update things related to that host's display. I don't forward X connections (no `-X`), but `xrandr` keeps saying it can't find the display. Invoked locally on that host, `xrandr` works as intended. How do I make `xrandr` ignore the fact that I'm logged in remotely, and just operate on the host on which it is running?


Notify-send not working when run from apache

I have the following script (`alert.sh)` which has been setuid'd:               DISPLAY=:0.0 notify-send --urgency=low -i python "The job has finished"      and the following PHP file `alert.php`:               <?php     echo exec("/path/to/alert.sh")      When I `su` to `www-data` and run `php alert.php`, I get an alert on my screen. All good. However, when I open `alert.php` in the browser, nothing happens. I suspect some environment variable needs to be set, but I'm not sure which.


How to access X display from a cron job when using gdm3?

> **Possible Duplicate:**   >  Open a window on a remote X display (why "Cannot open display")? I'm trying to run a cron job that needs access to my X session. I know my X session will always be :0, so part of it is easy:               /30 * * * * DISPLAY=:0 command      but the problem is that gdm3 no longer uses `$HOME/.Xauthority`; instead it uses `/var/run/gdm3/auth-for-anthony-XXXXXX/database` where the X's change each login. Other than symlinking `$HOME/.Xauthority` to the GDM3 file each login (or editing crontab each login, etc—automatically in `.xsession` of course), is there some way to get the cron job working?


Xlib: No protocol specified

> **Possible Duplicate:**   >  Open a window on a remote X display (why "Cannot open display")? I have a script that when run independently works that needs X11 Display variables to be set. When I invoke this script using a background daemon job, I get the following error.   `Xlib: connection to "localhost.localdomain:0.0" refused by server`   `Xlib: No protocol specified`   Please help me identifying the possible mistake that I have in this.   Commands given below which is inside the script.   `export DISPLAY=`hostname`:0.0`   `java ScreenCapture`   If the same script is invoked by a background daemon running as a service, I get the error.


unable to forward X11 applications

I installed a headless Debian server which has Wireshark installed. Now I would like to run Wireshark in a way that it uses X11 server running in my Linux Mint laptop. As a first step I permitted X11 forwarding in Debian SSH server configuration file:               root@A58:~# grep X11Forwarding /etc/ssh/sshd_config      X11Forwarding yes     root@A58:~#       Then I restarted SSH server with `/etc/init.d/ssh restart` and finally executed SSH client in my laptop using `-X` which enabled X11 forwarding. However, I still receive the "cannot open display" error:               root@A58:~# echo "$DISPLAY"     localhost:11.0     root@A58:~# wireshark           (wireshark:3590): Gtk-WARNING **: cannot open display: localhost:11.0     root@A58:~# time xterm     Warning: This program is an suid-root program or is being run by the root user.     The full text of the error or warning message cannot be safely formatted     in this environment. You may get a more descriptive message by running the     program as a non-root user or by removing the suid bit on the executable.     xterm: Xt error: Can't open display: %s          real    1m3.131s     user    0m0.000s     sys 0m0.000s     root@A58:~#      Is the "$DISPLAY" variable correct? At the moment it's pointing to Debian server.. If the "$DISPLAY" variable is correct, then it's probably an authorization issue with X11 server? EDIT: if it helps, then X11 in laptop is started in following manner:               root      1113  0.1  4.3 101396 89992 tty7     Rs+   2013  44:28 /usr/bin/X :0 -nr -verbose -auth /var/run/gdm/auth-for-gdm-FHVC1j/database -nolisten tcp vt7


How to install backtrack 5 onto a USB that doesnt mount with existing OS

I believe the title states what im mostly asking but here's the specs. Sandisk Cruzer 4GB USB 2.0 Existing OS: Windows Xp Professional SP3 Hardware: Intel Pentinium 4 Xeon Class (x86 F15 M2 S4) [1.8Ghz] IBM Thinkpad T-Series T30 So what I am wanting to do is, Put backtrack onto the usb and run it like the usb was a hard drive. This way it doesnt affect the physical machine and doesnt erase the current OS. Is there a way of doing this?


Entries I can safely exclude doing backups

I'm planning a backup strategy based on rsnapshot. I want to do a full system backup excluding files and directories that would be useless for the restore to have a working system again. I already excluded:               # System:     exclude /dev/*     exclude /proc/*     exclude /sys/*     exclude /tmp/*     exclude /run/*     exclude /mnt/*     exclude /media/*     exclude /lost+found          # Application:     exclude /*.pyc     exclude /*.pyo      I wonder which other entries I can add to the exclude list without compromising the restored system. Talking about a "generic" Linux system, can you suggest further glob extensions, temporary directories, caches, etc. I can exclude safely?


Text to yaml conversion

I have a tab separated text file in this format:               your-email  your-order-id   PayPal-transaction-id   your-first-name your-second-name     s@ess.com   12345   54321   sooky   spooky     t@tee.com   23456   23456   kiki    dee     r@arrgh.com 34567   76543   cheeky  chappy      and I'd like to use awk to convert this to yaml:               ---          your-email: s@ess.com     your-order-id: 12345     PayPal-transaction-id: 54321     your-first-name: sooky     your-second-name: spooky          your-email: t@tee.com     your-order-id: 23456     PayPal-transaction-id: 23456     your-first-name: kiki     your-second-name: dee          your-email: r@arrgh.com     your-order-id: 34567     PayPal-transaction-id: 76543     your-first-name: cheeky     your-second-name: chappy      So far my awk script looks like this               #!/usr/bin/awk     FS=="\t"     BEGIN {print "---"}      NR==1 {for (i=1;i<=NF;i++) print $i ": "}      But I can't figure out how to get each field from line 1 onwards to print after it's header and then recreate the yaml key values from the first line of the input file. In the real file there are 38 fields and 34 records (so not huge).


What are commands to find shell keywords, built in functions and user defined functions?

I was discussing with my friend on how the commands are parsed in the shell, and he told me that bash searches the command in following order   1. List of aliases    2. List of shell keywords    3. List of user defined functions    4. List of shell built in functions    5. List of directories specified in the PATH variable , from left to right. I know aliases can be found by issuing the `alias` command. PATH variable contents can be found using `echo $PATH` command. Can you please tell me which commands do I need to use ?   1. To list all shell keywords    2. To list all user defined functions    3. To list of shell built in functions


Edit a file in several emacs sessions

Emacs says > You want to modify a buffer whose disk file has changed since you last read > it in or saved it with this buffer. > > If you say `y` to go ahead and modify this buffer, you risk ruining the work > of whoever rewrote the file. If you say `r` to revert, the contents of the > buffer are refreshed from the file on disk. If you say `n`, the change you > started to make will be aborted. > > Usually, you should type `n` and then `M-x revert-buffer`, to get the latest > version of the file, then make the change again. Why does it recommend > Usually, you should type `n` and then `M-x revert-buffer`, to get the latest > version of the file, then make the change again, rather than > say `r` to revert, the contents of the buffer are refreshed from the file on > disk? Are the two really different? They seem the same to me?


Check values in a text file

Is there a simple way to check if values in the second column of a file ( File 2) exist in the second column of another file (File 1), for example by printing a star next to the concerned line? If possible using awk. File 1               A   1,2,3,4      B   15,16,17      File 2               A   3     B   18      Expected output: File 3               A   1,2,3,4     *     B   15,16,17               **EDIT** What if File 2 looks like:               A    3,8     B    18,19      but the expected output remains the same?


Backed up over wrong hard drive

I've just written over the wrong hard drive using the command:               sudo sh -c 'pv /dev/sdb >/dev/sdc'      How do I go about undoing this? I was creating the first even backup of the drive, and I backed up over the wrong drive... The drive which got written over also has no backups, I was going to backup that drive next. Both drives were dm-crypt'ed.


Delete whole line if after ":" less than 4 chars

I have a file with many lines, such as :               blue:fish     red:tomato     black:moon      I would like the whole line to be deleted if after ":", there is less than 4 chars. Thanks for your help!


Question about using pdflatex on RedHat in CentOS

I am a novice in using Linux systems. I was given an assignment of writing a document using LaTeX and converting the file into a pdf file to submit. So I tried using my CentOS to do so. The version of my Linux system is RedHat. I've looked up ways to convert .tex file into .pdf on the web, which told me to install texlive. So I did so.               [csi2102@localhost]$ yum install -y texlive     Loaded plugins: fastestmirror, refresh-packagekit     Loading mirror speeds from cached hostfile       * base: data.nicehosting.co.kr       * extras: data.nicehosting.co.kr       * updates: data.nicehosting.co.kr     Setting up Install Process     Package texlive-2007-57.e.16_2.i686 already installed and latest version     Nothing to do      So I looked up for ways to solve this problem and one of the websites suggested of using `rpm -qa | grep tex` command. But nowhere could I find the pdflatex file.               [csi2102@localhost]$ rpm -qa | grep tex     texlive-texmf-errata-dvips-2007.7.1.e16.noarch     texlive-2007.57.e16_2.i686     texlive-texmf-errata-fonts-2007.7.1e16.noarch     texlive-texmf-2007-38.e16.noarch     texlive-texmf-fonts-2007-38.e16.noarch     texlive-texmf-errata-2007-7.1.e16.noarch     texlive-texmf-dvips-2007-38.e16.noarch     [csi2102@localhost]$       This is what I saw when I typed the command. When I try to use pdflatex, latex, or pdftex command, this is what I get.               [csi2102@localhost]$ latex homework     bash: latex: command not found     [csi2102@localhost]$ pdflatex homework     bash: pdflatex: command not found     [csi2102@localhost]$ pdftex homework     This is pdfTeXk, Version 3.141592-1.40.3 (Web2C 7.5.6)      %&-line parsing enabled.     entering extended mode     (./homework1.tex     !Undefined control sequence.     1.7 \documentclass                        [pdftex,11pt] {article}     ?      I don't see why my system would not recognize unlike how other people have been saying. P.S. Oh, and just in case, I wanted to attach my .tex file wondering if what I have written in my file was creating the problem.               \documentclass[pdftex,11pt] {article}     \usepackage[utf8] {inputenc}          \usepackage{geometry}     \gemoetry{a4paper}          \usepackage[dvips]{graphicx}     \usepackage{pslatex}          \usepackage{fancyhdr}     \pagestyle{fancy}     \renewcommand{\headrulewidth}{0pt}     \lhead{}\chead{}\rhead{Introduction to Engineering Design}     \lfoot{}\cfoot{\thepage}\rfoot{}          \usepacakge{sectsty}     \allsectionsfont{\sffamily\mdseries\upshape}          \title{What is \LaTex ?}     \author{2013147549 Geun Ho Lee}     \date{}          \begin{document}     \maketitle           LaTex is a document preparation system that is most often used for medium-to-large technical or scientific documents. It is not, however, a word processor. It is based on the idea that it would be more efficient for the authors to write their documents and let the document designers to worry about the document design. LaTex consists of several features ranging from typesetting journal articles, technical reports, books, and slide presentations to automatically generating bibliographies and indexes.           LaTex is based on the TeX typesetting language or certain extensions of it. LaTex was first developed in 1985 by Leslie Lamport and is now maintained and developed by the LaTex3 Project.           (source: http://latex-project.org/intro.html)          \end{document}


How to change wrong mime type for msi file?

`file -i <here msi file>` returns `application/vnd.ms-office` and I think that is wrong. I need a more specific mime type for msi files. I know about magic files but I really need some help with them. I have no internet on this PC so I need edit file manually. How can i correctly do that?


Why can't I specify my root fs with a UUID?

My system boots OK with this in my GRUB 2 config:               linux   /bzImage root=/dev/sda2 init=/usr/lib/systemd/systemd ro      But if I replace `/dev/sda2` with the corresponding UUID:               linux   /bzImage root=UUID=666c2eee-193d-42db-a490-4c444342bd4e init=/usr/lib/systemd/systemd ro      then it fails during boot:               kernel panic - not syncing: VFS: unable to mount root fs on unknown-block(0,0)      The UUID appears to be correct:               # blkid     /dev/sda1: UUID="97ac3744-39de-4d6d-9a81-e3a3ea08a8bb" TYPE="ext2"      /dev/sda2: UUID="666c2eee-193d-42db-a490-4c444342bd4e" TYPE="ext4"       Why doesn't it work? Is it because I'm not using an initramfs? This is x86_64 Gentoo Linux with kernel 3.10.7. I'm using a MBR partition table on `sda` and a GUID partition table on `sdb`.


Best way to find out what Linux Version is used on a Webserver

Is this feasible? Can I find out which distro is used to host specific webpages? Whois doesn't have info for this.


Ssh keeps asking for passphrase several times

I have a remote machine, with which I have set up public-key ssh auth - that is, I can ssh to it without typing in password each time. And I have a set of actions in a script, which use that ssh connection. But when I run that script via cron, it keeps asking passphrase for each action - and since I have more that ten of them, it gets quite boring. I tried running ssh-add before those actions and got:               Could not open a connection to your authentication agent.      What can I do to reduce number of passphrase retypes?


How to Suppress messages generated by an application being sent to my terminal window?

When I launch an application from terminal related to the window system, for example gnome or kde, then usually these applications send all sorts of junk messages in my terminal. How do I make these applications shut up? For example if I type:                okular somepdf.pdf &       a window which shows the pdf file pops up and I can read the pdf next to my terminal, and when I am done I close. Here is a typical example:               :~$ cd Documents     :~/Documents$ okular equi.dvi &     [1] 5823      and when I close it sends this junk to the terminal:               :~/Documents$ okular(5823)/kdeui (kdelibs) KXMLGUIClient::~KXMLGUIClient: 0x2322528 deleted without having been removed from the factory first. This will leak standalone popupmenus and could lead to crashes.      d          d: command not found     [1]+  Done                    okular equi.dvi     [1]+  Done                    okular equi.dvi     :~/Documents$       The only thing I would like to see is:               :~$ cd Documents     :~/Documents$ okular equi.dvi &     :~/Documents$      Perhaps that message was some bug, I do not care and I do not want to know about it. Is it possible to suppress these messages?


Why are shared libraries executable?

Why have almost all the shared libraries in `/usr/lib/` have the executable permission bit set? I don't see any use case for executing them. Some do manage to hook-up some form of `main` function to print a short copyright and version note, but many don't do even that and segfault upon execution. So, what's the point of setting this `x`? Must all library packagers do that? What will happen if I `dlopen()` a shared library that has `0644` permissions?


How to move the files based on Year

I need to move files based on a year. I used the `find` command               find /media/WD/backup/osool/olddata/ -mtime +470 -exec ls -lrth {} \;|sort -k6      but for this command to successfully execute i need to know the exact `mtime` now 470 is just a guess. Means if I can give the year 2012 it gives me files only related to 2012. So i need advice on how to > Find files based on year e.g 2012 and move them to other directory.               OS release 5.2          FIND version     GNU find version 4.2.27     Features enabled: D_TYPE O_NOFOLLOW(enabled) LEAF_OPTIMISATION SELINUX


Which amongst the given option is TRUE about login shell?

Which amongst the given option is TRUE about the login shell?   1. The login shell varies every time the user logs in. The kernel decides on the availability of the shell during login.    2. The login shell is fixed for all the users in a particular system. It cannot be configured.    3. The login shell can be configured by the administrator in /etc/passwd file.    4. None of the above.


What is the routing behaviour when two or more default routes?

I have two ISP at the time, connected to the same machine. I added both of them in the routing table as default. However, only one connection is used.               $ route     Kernel IP routing table     Destination     Gateway         Genmask         Flags Metric Ref    Use Iface     0.0.0.0         192.168.1.1     0.0.0.0         UG    303    0        0 eth0     0.0.0.0         192.168.0.1     0.0.0.0         UG    303    0        0 eth1     192.168.1.0     0.0.0.0         255.255.255.0   U     303    0        0 eth0     192.168.0.0     0.0.0.0         255.255.255.0   U     303    0        0 eth1      How can I balance the traffic load between the two ISP?


.bashrc doesn't get executed

I have a user (non-root) which has a `~/.bashrc` file with some aliases in it. But it doesn't look like the file is executed at log in time. If I do `source ~/.bashrc` then it does what it's supposed to. But isn't `~/.bashrc` supposed to be executed every time I log in? Permissions are set to 644 (same as my root's `.bashrc`, which works fine). File is owned by the user in question.


what is 'smakynet' in the netstat result?

after logging into a server, I used netstat to check out the ports of this server and wanted to find which port was communicating with me My IP is 143.248.143.198 and my search results are like below:               [kwagjj@James5 ~]$ netstat | grep 143.248.143.198     tcp        0     52 James5:smakynet             143.248.143.198:49690       ESTABLISHED     [kwagjj@James5 ~]$ netstat | smakynet     smakynet: Command not found.     [kwagjj@James5 ~]$ netstat | grep smakynet     tcp        0      0 James5:smakynet             143.248.143.199:49573       ESTABLISHED     tcp        0      0 James5:smakynet             143.248.143.198:49690       ESTABLISHED     tcp        0      0 James5:smakynet             143.248.143.212:51070       ESTABLISHED     tcp        0      0 James5:smakynet             143.248.143.210:9693        ESTABLISHED     tcp        0      0 James5:smakynet             143.248.143.217:azeti       ESTABLISHED     tcp        0      0 James5:smakynet             143.248.143.216:51892       ESTABLISHED     tcp        0      0 James5:smakynet             143.248.143.210:10599       ESTABLISHED      I tried to see if James5:smakynet lead to some other port but it looks like my side of the port is only communicating with 'James5:smakynet'. Does anyone know what this 'smakynet' is? What does this do? I googled it but it didn't give me any proper info.


What is a good distribution to use that is similar to Amazon Linux

I'm running the "Amazon Linux" OS/distro in production on EC2, But I'd like to do some local development/testing with VirtualBox VMs. What would be a good distribution to use that is most like Amazon Linux. I'm most interested in making sure that I have the same packages available to me. I'm most familiar with yum/rpm based distros, so that's where i'd like to stay, but if there's another distro that will have better package similarity with apt instead I suppose I can make that work. A brief list of the packages I need to run are mysql5.5, apache2.2, php5.3 and tomcat7.


How do I suppress a warning message?

touch ~/deleted/$(echo "directory_"$(readlink -f foo)|tr '/' '\') 2> /dev/null      where foo is a directory It's reading the full pathname of foo and creating it as a file replacing all '/' with '\' and putting a directory_ in front so the directory `/home/test/foo` would create a file `directory_\home\test\foo` It does exactly what I want except a warning keeps printing `tr: warning: an unescaped backslash at end of string is not portable` a. I don't know what that means b. I would like it to not show I tried to redirect stderr to `/dev/null` but it doesn't work. How do I suppress it?


How can I colorize head, tail and less, same as I've done with cat?

I've got 'color cat' working nicely, thanks to others   (see How can i colorize cat output including unknown filetypes in b&w?). In my `.bashrc`:               cdc() {       for fn in "$@"; do       source-highlight --out-format=esc -o STDOUT -i $fn 2>/dev/null || /bin/cat $fn;       done     }     alias cat='cdc' # To be next to the cdc definition above.      I'd like to be able to use this technique for other functions like head, tail and less. How could I do that for all four functions? Any way to generalize the answer? I have an option for `gd` doing `git diff` using               gd() {         git diff -r --color=always "$@"     }


Is there a good FOSS utility for converting machine code to assembly or even C?

If I buy a piece of x86 32-bit or 64-bit software but I don't receive the source code, and I need to modify the software, I'll need to convert the machine code back into a high level language or at least assembly code. Is there a good utility to go from machine code to C? I assume that it would attempt to identify whether the program was compiled with a C compiler as opposed to C++ or Objective C or anything else. Thanks.


SSH: tunnel without shell on ssh server

I have to set up a tunnel between two hosts. For this i use `ssh` in this way:               ssh -L MY_LOCAL_PORT:FOREIGN_ADDRESS:FOREIGN_PORT MYUSER@SSH_SERVER      after that, I login into my SSH_SERVER. How can I avoid this feature?! I have only to set up a tunnel. I don't have to login into my SSH_SERVER... I've tried the -N option, but it keep my shell busy


is there a proper syntax for the expression or is this impossible

STD_IN=&1          data=<( read data from $STD_IN  ; echo $data; )      echo $data      Target: Is to get a blocking read into the subshell like this


PgPool - Host Based Routing

I'm using `pgpool` to distribute my connections between my master and slave postgresql databases. What I would like to know is if there is a feature where I can tell `pgpooler` to route connections coming from a certain user to the master only. So lets say if a web application is connected to `pgpooler` with USER-A, route all the connections to master, otherwise, let `pgpooler` do it normal work. I know about white list functions and I am using them for certain cases, but I'm looking for something more complicated.


Automated SSH Login

> **Possible Duplicate:**   >  Shell Script for logging into a ssh server   >  Autentification on SSH connection in OneLine How could I make a SSH Login programmatically on a unix server, I don't have rights for generate public keys on the side server or extra-packages like expect. The client is a windows os, so I use putty to do the connections. Is there any way to use putty on my program or any java library for this?


Conditional block vs conditional statement (if)

Say I have a file:               PRO 1     GLN 5.55112e-17     ILE -6.245e-17     THR 5.55112e-17      I want every line that has a number unequal to 1 in the second column to change it to 0 and keep the rest. If I use `if` (i.e conditional statement), everything is OK:               awk '{if($2!=1){print $1,"0"}else{print $0}}' file     PRO 1     GLN 0     ILE 0     THR 0      But when I use the conditional block, something undesired happens:               awk '$2!=1 {print $1,"0"} {print $0}' file     PRO 1     GLN 0     GLN 5.55112e-17     ILE 0     ILE -6.245e-17     THR 0     THR 5.55112e-17      You can see what's wrong.   * How do I fix this error?   * Why does this error occur?   * What's the different between a conditional statement and a conditional block?


Keyboard layout bug in login window after screen lock

I use Fedora 16 now, but this issue already was in Fedora 15 before I upgraded it. When I lock my screen and then want to unlock it, I have a default English layout (I am from Russia and also have Russian layout). My layout switching shortcut is `Ctrl`+`Shift`. When I try to enter my password, I get a login failure, and I must switch layouts twice (to Russian and again to English), and then login is successful. How can I fix this issue?


tabs when using 'screen'

I am using **Ubuntu** 10.04. After I installed `screen`:               sudo apt-get install screen      I made two **ssh** connections to two remote servers by doing the following things step by step (I do the following steps according to the document here): **1.** open a termnal window, run command `screen` **2.** press `Ctrl`+`A`+`c` to create a new virtual console **3.** `ssh usr@IP1` **At this point,** I have one virtual console which shows I have connected to the remote server(IP1). **4.** press `Ctrl`+`A`+`c` to create a new virtual console **5.** `ssh usr@IP2` So, now I have connected to two remote servers(IP1 & IP2). **But** , **I do not have two tabs** on one terminal window, instead, I have to use `Ctrl`+`A`+`p` and `Ctrl`+`A`+`n` to switch between the two virtual console in **one** terminal window. Isn't it so that by using `screen`, I could have **two tabs** in one terminal window, with each tab display one connection to one remote server. Why I do not have the **tabs** in my terminal window?


filename matching pattern

I have a folder of 200 satellite files to process. There are three steps in the process and I want to use a shell script under ubuntu to process them. I am using a for loop. My problem is the filenames. An example is A2013290123000.L1A_LAC.Ireland.hdf. I can create variables ie.               DATE=A2013     DATE1=`date +%j` #gives me the number of days since jan 1st 2013 in example above this would be 290     .L1A_LAC.Ireland.hdf part of the name doesn't change.      My issue is with the middle part of the name, in example above:123000 There is no pattern to this part of the name. It is a time stamp but varies with each file. I want to create a variable in the script such as               TIMESTAMP=$DATE$DATE1$DATE2      Where DATE2= the middle part of the file name. Is it possible to specify this variable as a wild card something like:               DATE2=$*      I hope to have the value of the variable `TIMESTAMP= A2013209123000`               #!/bin/sh          #set -e          set -x #debug mode          <<comment     export OCSSWROOT=/home/seadas/seadas-7.0/ocssw     source $OCSSWROOT/OCSSW_bash.env     export PATH=$PATH:/home/seadas/seadas-7.0/bin     comment          DATE=A2013     DATE1=`date +%j`     DATE2=$*     TIMESTAMP=$DATE$DATE1$DATE2     LOCATION_NAME=Ireland          DATADIR=/home/MODIS     L2_DIR=/home/MODIS/L2     GEO_FILE_DIR=/home/MODIS/GEO     L1B_DIR=/home/MODIS/L1B     SCRIPTDIR=/home/seadas/seadas-7.0/ocssw/run/scripts     FILTERDIR=/home/seadas/seadas-7.0/ocssw/run/data/common     FUNCTION=/home/seadas/seadas-7.0/ocssw/run/bin/linux_64          HDFFILE=$TIMESTAMP.L1A_LAC.$LOCATIONNAME.hdf     GEOFILE=$LOCATION_NAME-$TIMESTAMP.GEO     LACFILE=$TIMESTAMP.L1B_LAC     HKMFILE=$TIMESTAMP.L1B_HKM     QKMFILE=$TIMESTAMP.L1B_QKM     L2FILE=$TIMESTAMP.L2.hdf               for i in `ls -r $DATADIR`          do         echo "Start a Process for file $i";          'Generating geolocation file' $SCRIPTDIR/modis_GEO.py -d $DATADIR/$HDFFILE -o $GEO_FILE_DIR/$TIMESTAMP.GEO --threshold=95;          'Generating L1B file' $SCRIPTDIR/modis_L1B.py $DATADIR/$HDFFILE $GEO_FILE_DIR/$TIMESTAMP.GEO -o $L1B_DIR/$LACFILE -k $L1B_DIR/$HKMFILE -q $L1B_DIR/$QKMFILE;          'Generating L2 product'$FUNCTION/l2gen ifile=$L1B_DIR/$LACFILE geofile=$GEO_FILE/$TIMESTAMP.GEO par=$FILTERDIR/msl12_defaults.par ofile=$L2_DIR/$L2FILE resolution=-1 l2prod="default,sst,qual_sst,qual_sst4,sstref,sst4" filter_opt=0 proc_ocean=1 gas_opt=15;          echo "it $i is finished..."               echo "\n"     done


Which was the very first music player application for Linux?

I'm writing an article about FOSS and Linux music players. What was the very first music player application for Linux? Was there ever a time when the players didn't support proprietary formats like MP3s?


Error: integer expression expected

I have written a script to determine the Load average on the server as follows:               #!/bin/bash          loadavg=`top -b -n1 | grep -i load | awk -F, '{print$4}'| awk -F: '{print $2}'`          if [ "${loadavg}" -le  1 ]     then     echo "OK - Load Average = ${loadavg} | Load_Average=${loadavg}"     exit 0;     elif [ "${loadavg}" -gt 1 ] && [ "${loadavg}" -le 2 ]     then     echo "WARNING - Load Average = ${loadavg} | Load_Average=${loadavg}"     exit 1;     elif [ "${loadavg}" -gt 2 ]     then     echo "CRITICAL - Load Average = ${loadavg} | Load_Average=${loadavg}"     exit 2;     else     echo "UNKNOWN - Load Average = NaN | Load_Average=NaN"     fi      When the script is executed, it displays following error:               ./loadavg.sh     ./loadavg.sh: line 5: [:  0.06: integer expression expected     ./loadavg.sh: line 9: [:  0.06: integer expression expected     ./loadavg.sh: line 13: [:  0.06: integer expression expected     UNKNOWN - Load Average = NaN | Load_Average=NaN


Oracle 11gR2 grid silent installation: error for privateinterconnects

I am installing Oracle grid 11gR2 using silent install with response file. I am getting error after "Collecting interface information for node 1" in logs. I have a feeling that this could be due to option `oracle.crs.config.privateinterconnects=eth0:xxx.xxx.xxx.xxx:1,eth1:xxx.xxx.xxx.xxx:2` Here I have specified only for 1 node. Do I need to specify interconnects for both nodes. `ERROR message: One or more nodes have interfaces not configured with a subnet that is common across all nodes.`


Is there something that will generate keyboard's click sounds?

I miss using a clicky keyboard at work. It's a fairly quiet office, so I'm stuck using a nearly silent keyboard. The upshot is that I can wear headphones. Is there something in Linux or X that can respond to all keyboard events with a nice, sharp click, giving me that audio feedback? Before you think I'm crazy, I know some high-end keyboards even have speakers in them to reproduce this click for those who like the audio feedback. I'm looking for something at the operating system level.


How to pan the terminal beyond desktop window to view all output on watch?

I am watching my iptables with               watch -d 'iptables -vnL --line-numbers'      As the output above extends beyond the current desktop window height, how can I pan the terminal display to view information beyond? Currently, I can only drag the top bar to move the terminal display around, but I am not able to grab the terminal anywhere else with my mouse to pan it up further so that I can see information further down.


MP3+FLAC tag editor for Linux

> **Possible Duplicate:**   >  Which mp3 tagging tool for Linux? Are there any good batch tag editors for Ubuntu/Fedora? Which one is the best?


VirtualBox guest hangs when: Starting Apparmor profiles

I have a Fedora 14. I installed the Ubuntu 11.04 i386 mini.iso in Virtualbox. After install when I reboot it it just hangs with this message:               /dev/mapper/vg-root: tiszta, 52354/5103616 fájl, 559633/20408320 blokk     init: ureadahead-other main process (420) terminated with status 4     [   14.569632] piix_smbus 0000:00:07.0: SMBus base address uninitialized - upgrade BIOS or use force_addr=0xaddr      * Starting AppArmor profiles    [ OK ]      First line translates from Hungarian to English as:               /dev/mapper/vg-root: clean, 52354/5103616 files, 559633/20408320 blocks      What should I do to boot this Ubuntu guest? Is it a bug? UPDATE: If I switch to another tty then I can see the log in screen/terminal and I can log in too... ohh well, it's just a test guest vm... I hope when it comes to installing ubuntu minimal on a real machine it wont stop at the apparmor message.


convention regarding offline temporary data

When writing small utility programs, I sometimes want to keep small amounts of data around _between_ executions, usually for caching purposes, but don't want the program to run as a daemon. Are there any conventions regarding this? Making files in `/tmp` seems obvious, as it is usually kept in memory, and is only wiped at shutdown, but I'm curious if there are other ways. Also, is there a convention for naming files in `/tmp`?


How can I debug a Suspend-to-RAM issue on Linux?

I'm hoping to get experience-based suggestions on how to go about debugging suspend-to-RAM issue. Advice specific to my situation(detailed below) would be great, but I am also interested in general advice about how to debug such issues. **The problem:** Often, when I attempt to suspend my machine, it gets stuck in a "not suspended but not awake" state. Often the screen will be completely black but sometimes it will have the following error message on it:               GLib-WARNING **: getpwuid_r(): failed due to unknown user id (0)       Also, this state will also be accompanied by the fans kicking into high gear. The only way to get it out of this state is to manually power off the laptop. **Some Information**               $ uname -a     Linux baltar 2.6.35-22-generic #34-Ubuntu SMP Sun Oct 10 09:26:05 UTC 2010 x86_64 GNU/Linux          $ lsb_release -a     Distributor ID:    Ubuntu     Description:    Ubuntu 10.10     Release:    10.10     Codename:    maverick      I've taken a look at `/var/log/dmesg` and `/var/log/pm-suspend.log`, but I don't know what I'm looking for and nothing stands out. I'm unsure if it is related, but I did find a lot of the following in `/var/log/kern.log`:               EXT4-fs (dm-0): re-mounted. Opts: errors=remount-ro,commit=600


xfs quota not reliable

I have enabled quotas on an xfs-partition. But it seems to be broken:               $ echo asdf >/disk/l/data/avi/foo     -su: /disk/l/data/avi/foo: Disk quota exceeded          $ quota -f /disk/l     Disk quotas for user avi (uid x):       Filesystem  blocks   quota   limit   grace   files   quota   limit   grace      /dev/md0 1801035344  3000000000 4000000000           38063       0       0       Any ideas why? Edit: grpquotas explained the problem for some users, but I still have users quota issues for other users.               $ touch a     touch: cannot touch `a': Disk quota exceeded     $ quota -f .     Disk quotas for user s (uid 2267):       Filesystem  blocks   quota   limit   grace   files   quota   limit   grace        /dev/md0  293812  1000000000 2000000000               8       0       0     $ mount     /dev/md0 on /disk/l type xfs (rw,usrquota,grpquota)     # xfs_quota -x -c report |grep -v -- '------'     User quota on /disk/l (/dev/md0)                                Blocks                          User ID          Used       Soft       Hard    Warn/Grace               Group quota on /disk/l (/dev/md0)                                Blocks                          Group ID         Used       Soft       Hard    Warn/Grace          [... i.e. no groups or users over their soft limit ...]


Most "effective" archive to convert to

If you are like me, you have tons of archives lying around in different formats (zip, tar, rar, tgz, tar.bz2 etc). In cleaning up my stuff, I have decided to basically leave my archives alone ( and generally access contents via archivemount or avfs ). As a brief aside, for the most part I will not be writing to these archives, but on occasion I or an application may be write configuration files/index files/description files/stray files ... to these archives. However, I would like to have a preferred format that I convert these archives to when I clean up an archive. Some factors for this archive format are clear: it should be easy to convert other formats to this format, preferably directly; accessing files in the archive should not have significant overhead, size is of some consideration but not major, as long as an archive is not twice as big as the same files when extracted. Now I am not so naive as to expect people to reply with "the best archive format is ...", rather I hope to get some ideas of the pros and cons oif various archive formats that you might use in this situation.


Is it possible to capture all network traffic using tcpdump?

I have 3 computers on the same sub-net. Computer A and B are communicating with each other (ping, telnet, etc.). I'd like to see the packets between A and B on computer C. Is it possible to do this with tcpdump? I've read the manual and Googled this to no end but I can't make it work. tcpdump running on C does not see traffic between A and B. I know tcpdump is working because if either A or B pings C, tcpdump shows the network traffic. I've also manually put the interface on promiscuous mode (ifconfig ethx promisc) but still no output. > Comp-A, IP: 192.168.0.100   >  ping Comp-B ==> Comp-A gets reply from Comp-B > > Comp-B, IP: 192.168.0.101   >  tcpdump -Xi eth1 ==> Sees ping packets from Comp-A > > Comp-C, IP: 192.168.0.102   >  tcpdump -Xi eth1 ==> No output, just the generic tcpdump initial message


Can someone recommend a Linux Distro for purposes of just running a DNS?

I'm looking for an easy to setup Linux distro for just running a DNS server (and nothing else) with something easy to setup like DNSMasq. At home I run OpenWRT with DNSMasq on my Router, and at work I've been given the freedom to run a distro with a DNSMasq for purposes of doing development. I take my development laptop home and to work, so I want the setup to be nearly the same between locations. (of course I'll have to change it a little bit, the DNS server at home cannot have the same ip as the one at work).


Which configuration option controls whether Nautilus "copies" or "moves" a file/folder on drag and drop for a remote target directory?

In the Nautilus file manager (Files 3.6.3), when dragging and dropping a file into a directory, the behaviour appears to be dependent on the file-system location of the target folder. (either local or remote) Dragging and dropping to a local directory triggers a "move" of the source item, and this is the behaviour that I am used to and prefer. But if the target directory is a remote directory, for example on an NFS mount, then it triggers a "Copy" action. As it's not immediately obvious from the icon or context that the directory is remote, and further that the copy action might take some time, I am often left with the source files in place, and I don't notice that has happened until later. This is undesirable. I am aware that I can force a "Move" action using a `<Shift>` and `Drag`, and also that I can force a move using the `mv` command line. However I wish to configure Nautilus to attach the "Move" action to the drag and drop of a file to a remote directory. For me, this is the most common use case, and simplest and most efficient way to achieve that. I understand that this choice to default to copy-for-remote-targets may have derived from a desire to ensure the consistency of the operation. However it breaks the abstraction of the common interface provided by the virtual file system. I am looking for the configuration options that control that behaviour.


Can I "export" functions in bash?

source some_file      some_file:               doit ()     {       echo doit $1     }     export TEST=true      If I source **some_file** the function "doit" and the variable TEST are available on the command line. But running this script: script.sh:               #/bin/sh     echo $TEST     doit test2      Will return the value of TEST, but will generate an error about the unknown function "doit". Can I "export" the function, too, or do I have to source some_file in script.sh to use the function there?


Linux Kernel limit access to root with a button?

Is it possible to limit the access to a root account from within the kernel? I mean that if I press a button then the system detects the button being pressed and then allows access to the root account at boot. To me this could be useful to prevent a hacking attack from a bug of one of my programs that have an open port and maybe are vulnerable to attacks! If I can limit the attacker's movement maybe I can restrict the information it can have access to not compromising sensitive data. Is there a special way of doing this? Permissions like how android manage access, a boot parameter or another kernel? It is possible?


Add files to an iso image and auto run a script post installation

I'd like to add a tar archive in the standard Red Hat installation CD image and untar the same at a desired location using some post install scripts. Can you kindly suggest me how to proceed? In particular:   1. How do I add the tar in the iso image.   2. Where should I place the script.   3. How to link the script so that it is executed at the end of the installation process.


USB HDD Enclosure works with Ubuntu, but not Raspbian

SOLVED: Even though the enclosure came with its own power supply, it required a powered USB hub, probably for some internal components that don't draw power from the main supply. I have this dual HDD enclosure. http://www.raidsonic.de/data/products/icybox/IB-3620/E_IB-3620_Series_manual_v1.1.pdf Basic model IB-3620U3. The enclosure implements JBOD(single) so the installed drives are seen separately by the OS. I have no problems when I plug the device into my Ubuntu 14.04 laptop, I can see both HDDs and the "usb" LED(that shows it is connected by USB) lights up on the device. However, when I plug the device into my Raspberry Pi, running Raspbian, the HDDs are not seen and even the "usb" LED on the front of the device does not light. ## Outputs (pastebin urls) ### Raspbian: `lsusb` `dmesg` `uname -a` `fdisk -l` (just SD card) ### Ubuntu(laptop): `lsusb` `dmesg` `uname -a` `fdisk -l` **Note:** If I power up the device, while already plugged into my raspberry pi, the device's "usb" LED lights up, but there is no difference. **Note2:** I know the device doesn't officially support Linux, but hardly anything does on the box. I have 2 of these USB HDD docks which work perfectly with Raspbian. http://www.amazon.co.uk/Optimized-Inateck-Including-Comaptible-Tool- Free/dp/B00GIDNLI6/ref=sr_1_1?s=computers&ie=UTF8&qid=1403606340&sr=1-1&keywords=inateck+dock **Note3:** One drive is ext4, and the other is NTFS. Thank you for any help getting this thing working in Raspbian ### Edit: As requested, here is `lsmod(unplugged)` `lsmod(plugged-in)` on the Ubuntu laptop. And, `lsmod(unplugged)`, for raspbian. Doesn't change after plugging the device in. At a glance, it looks like the top modules `usb-storage`, `ccm`, and `ctr`, are the only ones to change on the laptop when plugging the device in. Where do I got from here ?


How do I make a multi-threaded app use all the cores on Ubuntu under VMWare?

I have a multi-threaded C++ app (using pThreads) that processes a massive flat file that works great on Windows - uses all four cores on my puny CPU. Client wants to run the same code on Red Hat on a fire-breathing 64 Xeon CPU machine. So I compile it here (g++), ran it on Ubuntu on VMWare, and code only used one of the four cores. So I'm thinking that is a VMWare problem, and I send code to client - where it does the same thing (as far as I can tell remotely - mpstat -P ALL shows the CPUs barely loaded). Do I need to do something to force Red Hat to spread out the threads? Is there something I'm missing - I'm trying to get the "nice" priority changed next - but I feel like I'm missing something. I can post code - but like I said, works great on Windows, uses pThreads, etc.


purpose of run-parts(8) utility

At least under Debian-based systems, there is a `run-parts` utility in **debianutils** package which is used in various scripts. For example in /etc/X11/Xsession. It will run all the executable files found in a directory. Why is run-parts needed while one could use `find` with `-perm` option or `test` utility? In addition, what does `run-parts` consider as an executable file? Looks like it does not simply check the file permissions:               # run-parts --list --lsbsysinit /etc/X11/Xsession.d | tail -1     /etc/X11/Xsession.d/90x11-common_ssh-agent     # ls -l /etc/X11/Xsession.d/90x11-common_ssh-agent     -rw-r--r-- 1 root root 629 2010-11-02 23:17 /etc/X11/Xsession.d/90x11-common_ssh-agent     # head /etc/X11/Xsession.d/90x11-common_ssh-agent     # $Id: 90x11-common_ssh-agent 305 2005-07-03 18:51:43Z dnusinow $          # This file is sourced by Xsession(5), not executed.          STARTSSH=     SSHAGENT=/usr/bin/ssh-agent     SSHAGENTARGS=          if has_option use-ssh-agent; then       if [ -x "$SSHAGENT" ] && [ -z "$SSH_AUTH_SOCK" ] \     #


Trying to create tunnel to mysql through SSH

Im in a bit of a bind here. I have a client that want's me to set up his website, but he runs the server w/ SSH and CentOS 6.2 as it's OS. Now, I'm trying to add the sql server on Mysql Workbench for easy handling, but I cant connect to Mysql. The SSH connection works fine, and I get privileges with sudo, so to speak. The server guy said (and I use PuTTY by the way ): Open a tunnel on port 3306 (source) to dest: 127.0.0.1:3306 which is the mysql port. I have the user as "root" and have tried with the password I use to log on to my local sql (phpmyadmin) as root, and I've tried with no password. He also mentioned that the mysql server only responds to loopback. After this I havent gotten a hold of him, and have very limited time. If you have pointers / suggestions or help I'd be very glad. Thank you. **Edit:** After countless hours of failure, I noticed I had used the wrong username for the Mysql connection inside Workbench. I used the same as my SSH login, which was wrong in my case. I had to use my dedicated Mysql username (obviously). Thanks for the help, anyways!


Translating user id when creating image

I want to create an image (for example ext3 image) from a given directory hierarchy. This directory hierarchy is owned by a given user. But on the final image, I want the files to be owned by superuser. Is there a solution for tranlating the user uid / gid to 0 ? Here is a pseudo workflow :   1. Create file hierarchy, as user in `/home/user/rootfs`   2. Create an ext3 img on a file   3. loop mount the empty img (as user or root) in `/somewhere/loopmount`   4. `cp -R --magic_uid_options 500=0 /home/user/rootfs /somewhere/loopmount` Or step 4 could be a normal copy and step 5 a clever find that would `chown` and `chgrp` recursively. Is there well known solution to this kind of problem ?


Execute command supplied by function parameters

I'm trying to create a function method in a bash script that executes a command which is supplied to the method by the paramters. Meaning somethings like this:               special_execute()     {         # Some code              # Here's the point where the command gets executed         $@              # More code     }          special_execute echo "abc"      I already tried I `$@`, `"$@"`, `$*`, `"$*"` how could I do that?


Possible to dual boot Linux Mint on any Windows 8 laptop?

I'm searching for a new laptop, and I'm currently considering getting an ASUS N56VZRH71. Everything spec-wise looks good (except for the absence of an SSD), but **I want to know if I'll be able to dual boot Linux Mint and Windows 8 on it**. I use Windows for most gaming, but I use Mint for work, and I'm confused about how Secure Boot affects computers. Also, if I find another laptop I'm interested in, how can I tell whether or not I'll be able to dual boot Linux and Windows on that?


Is it possible to determine what is inside Debian package without installing it?

I need a markdown library for development - based on package names I could not understand which one I should install...               den@playground:~$ sudo aptitude search markdown     p   html2markdown                                                          - convert HTML page into ascii markdown format     p   libhtml-wikiconverter-markdown-perl                                    - HTML to wiki markup converter - MoinMoin dialect     p   liblua5.1-markdown0                                                    - A pure lua5.1 implementation of the Markdown text-to-html markup     p   libmarkdown-php                                                        - PHP library for rendering Markdown data     p   libpod-markdown-perl                                                   - module to convert POD to the Markdown file format     p   libtext-markdown-perl                                                  - Markdown and MultiMarkdown markup languages library     p   libtext-multimarkdown-perl                                             - Perl module to convert MultiMarkdown syntax to (X)HTML     p   markdown                                                               - Text-to-HTML conversion tool     p   python-markdown                                                        - text-to-HTML conversion library/tool


Redistributable completion for my bash scripts

Is there a simple way to embed the completion features inside a script, for bash ? I have a script that I want to redistribute, but I can't ask the people to add something inside their `/etc/bash_completion.d` in order for them to get the completion working fot my script...


Shebang: History and Purpose

I have few questions about the magic number `#!`, the shebang.   I read that it was introduced by Dennis Ritchie in the 70s as a way to see a script as an executable file.   I don't understand, why it was introduced. What brought him to introduce it? What did he like?   The second think I don't understand is: why do I need to declare the script as an executable? I mean why do I have to do `chmod +x myscript`?   I think in the following way, once I put the string `#! myinterpter` then when I will make `./myscript` the OS will take this file, it will see that it contains the shebang and then it will call the appropriate interpreter. So why do I need to use `chmod +x`? Why do the OS (unix, linux) needs me to put my script as an executable?


Cannot delete a file - permission denied - why?

[db2inst1][testing ~/sqllib/db2dump] rm db2diag.log      rm: cannot remove `db2diag.log': Permission denied     [db2inst1][testing ~/sqllib/db2dump] id     uid=1002(db2inst1) gid=107(db2iadm1) groups=16(dialout),33(video),107(db2iadm1),108(db2fadm1),1001(eduserver)     [db2inst1][testing ~/sqllib/db2dump] ll     total 1381172     -rw-rw-rw- 1 root db2iadm1 1412931954 Oct  2 10:24 db2diag.log      Currently logged user (db2inst1) is part of db2iadm1 group that has w permission to the file I want to delete. But I am not able. Any idea why? ## update - permission for parent directory drwxr-sr-x 2 root db2iadm1 4096 Aug 22 14:39 db2dump


What are the benefits and downsides to use FuseFS filesystems?

I know some filesystems present themselves through Fuse and I was wondering about the pros and cons to this approach.


Core files when the symbols are stripped

I am building an application using g++ 4.3. I am using the with maximum possible optimization level, not using the `-g` option, and I am stripping symbols after it builds. If I do NOT strip symbols from my application and libraries, are the core files still useful? (When they are generated when the application crashes.) Will the core files be useful if I compile my application with maximum possible optimization? (Without `-g` option and without stripping symbols.)


Gnome saving dialogues keyboard shortcuts

For example when I try to save the destination of a link in `firefox` or save a copy of a pdf file in `evince` I get the following dialogue. ![enter image description here](http://i.stack.imgur.com/441g4.png) I find it annoying that I have to do some clicks (for example the tmp button and that to its left in my example) to select the folder. So is there a way to do this with _keyboard only_ with some kind of tab completion? Perhaps it's just changing a key in `gconf` perhaps it is possible to replace the saving dialogues by something better.


Changing file extensions

> **Possible Duplicate:**   >  Renaming multiple files (changing extension) Suppose I have a bunch of files with the extension `.x` and I want to change them so that they have the extension `.y`. I know `$ mv *.x *.y` wouldn't work because I havn't expressed each file to change their respective extensions (that and the command expects *.y to be a directory). What command should I issue?


Crunchbang as an optimal OS?

I have a small netbook that I've been using for all of my learning to program/learning to *nix needs. It is pretty underpowered (1gb RAM, 1.66hz processor) and has a dire battery life (under an hour really) as I got it for free from a friend. The Windows OS on it was slowing it down so much, and as they were giving it to me, I formatted and installed Crunchbang over the top. I'd never used Crunchbang before, but I have now become a big fan. It's quite confusing for me still, having no menu bar or anything, and having to manually edit the entries in the right-click menu if I want to add anything to it, but it is pretty speedy, and seems really quite nice to use. However, I'll soon be buying myself a new small netbook, with the same specs, but one with a much better battery life (apparently just under 8 hours in actual tests, with WiFi on and running Windows... two things I will not be doing), and was wondering whether or not Crunchbang would be a good choice of OS to install on it again? I know that 'which OS is better' makes for a very poor question, but I hope that mine is more specific, namely **is Crunchbang good for underpowered systems, and will it ever restrict my ability to do things that I might want to do when it comes to programming/delving further into the workings of computer systems? If so, what is a good alternative? Or is it simply a matter of taste?**


Forcing an 'added' alias to every command

Is it possible to forcibly add a timing alias (for lack of a better way to phrase it) to every command in `bash`? For example, I would like to have a specific user who whenever a command is run, it is always wrapped either with `date` before and after, or `time`. Is this possible, and, if so, how?


Time all executions in bash

Is there a way to run _all_ commands in `bash` as if they were invoked with `time` in front? I want that I could type `$ some_command` and this will actually invoke `$ time some_command`.


Meaning of patching binary files?

I am trying to understand what it means by patching binary files in an example from the manpage of `xxd`:               Patch the date in the file xxd.1     % echo "0000037: 3574 68" | xxd -r - xxd.1     % xxd -s 0x36 -l 13 -c 13 xxd.1     0000036: 3235 7468 204d 6179 2031 3939 36  25th May 1996        1. Does it mean editing binary files, or is it like in Wikipedia > A patch is a piece of software designed to fix problems1 with, or update a > computer program or its supporting data.   2. How do `xxd` and `patch` differ, and are they similar?   3. What does the example try to do?


Books/Resources which explain TCP/IP kernel implementation

I only know about: 1) Internetworking with TCP/IP: Vol.II, Design, Implementation, and Internals 2) TCP/IP Illustrated, Vol. 2: The Implementation but these are quite dated. I am particularly interested in Open source implementations. Any ideas? EDIT: I found another book 1) TCP/IP Architecture, Design and Implementation in Linux


Files uploaded as root to the web server can't be overwritten by web application

Here is my problem. I am developing a web application in PHP/MySQL and I am having some problems setting up the accounts I need to use. Development workstation: WinXP SP3, Eclipse PDT Development server: Debian 6.0, Apache2, MySQL 5, XDebug Connected through a LAN. While I am developing I upload code that needs to be tested to the server. I use GIT and ssh:root@myserver. As expected, the files end up being owned by root in the server. My web application needs to update some of the files. To allow that I ran chmod in the server to change ownership of the files to www-data. This works fine. The problem is that every time I change a file and upload it again it reverts back to root ownership and I have to manually change it back to www-data. I don't think this will be a problem in the production environment because I can ensure the files will have the correct ownership when they go live. However it is a pain the development process. What I am thinking: 1 - I probably should not be uploading with a root account. I tried connecting to the server through ssh using the user www-data. However it asks for a password and after some reading I found out that it is probably not a good idea to mess with www-data user. 2 - I could probably create another account for development purposes and upload the files with that account. The problem is that I don't know how to configure my web application to use that account when connecting to the server and database. 3 - I could probably configure my application and database to run as root in the development environment. This would resolve the problem. However as stated in 2 above, I don't know how to do it and I something tells me that this would not be a good idea. So I am looking for advice on how to solve my problem. I could go with any one of the three alternatives above (or even a 4th one that I haven't considered). Thanks. ### Update - 2011-09-13 One solution from the responses below (thank you cdp1337) is to run a script to update the file permissions when I upload files to the development server. In my case, I could run               chown -R www-data:www-data *      in the root of my website. **_NOTE: this is NOT in the production environment and the development web server cannot be accessed outside our company. This is not a solution to deploy to production environment._** Any other ideas? Thanks.


How to force crontab to check for changed files

I have a gentoo Linux system in which I am logged in as root. How can I force `crontab` to read new/changed files in `/etc/cron.d` immedeately, so that even a new cronjob is executed if even only seconds away?


Permissions on an ext4 filesystem on a removable drive used in different machines

I have a USB flash drive with `ext4` file system and its files are owned by my user on my local machine, for example by `myuser@myhost` with `700` permissions. If I unplug my flash drive and plug it in other Linux machine, can users of that machine have access to files in the flash drive? What if there is also a user named `myuser`, can he access those files?


Automatically mount encrypted home folder on login

I'm looking into encrypting my home folder with Truecrypt, and mounting it after I've logged in, which should be pretty straightforward. However, it occurred to me that it should be theoretically possible to mount it _as_ I'm logging in, as long as my account password is the same as my Truecrypt password. Is there a way to get PAM to run a command on login and pass the command my password as an argument? Or is there some other way to accomplish the same effect, without me needing to provide the password multiple times?


Is it possible to change password database file(/etc/passwd) in linux?

Is it possible to change password database file(`/etc/passwd`) to some other file. How does this authentication mechanism work internally ? Does it depend on pam ?


How to deliberately activate cooling fan of laptop?

Hi I have a laptop (Fujitsu Siemens Amilo 4000), I'd like to control the cooling fan manually. How do I do that? `/proc/acpi/fan/` is empty, the fan is otherwise working well. Distro is Fedora 14.


internal speaker not working ubuntu 10.10

I have a dv6000 laptop . My speaker and mic were working few days ago . But now only external speaker works. Can anyone suggest me some solutions please. Thanks.


Ubuntu crontab php not working

Yes, I have read many, many documentations but I can't get it to work. I have a simple single php file which I want to run once or twice in a minute. My php file is called: cronjob_refresh.php and I'm using Ubuntu 12. After typing > crontab -e I'm getting in terminal: > root@cron:~# crontab -e > > no crontab for root - using an empty one > > 888 I don't know what '888' is meaning... And I'm writing (after 888) my cronjob string > */1 * * * * php /var/www/cronjob/cronjob_refresh.php After hitting enter I'm getting '?' symbol after the cronjob string entered. > root@cron:~# crontab -e > > no crontab for root - using an empty one > > 888 > > */1 * * * * php /var/www/cronjob/cronjob_refresh.php > > ? Then I hit CTRL + Z to exit. After all this I'm executing > crontab -l to check if the cronjob is added to my cronjob list but it's saying that the list is empty. I don't know what I'm doing wrong. Also I wan't to execute twice in a minute, 30 - 30 sec. How to set the cronjob? I want to log everything in a file named logs.log in the same directory, is this is possible?


Add/delete workstation ip to /etc/sysconfig/iptables and then run service iptables reload

I need a script to add a users workstation ip to `/etc/sysconfig/iptables` and then run a `service iptables reload`. I need the same type of script for removing this rule from iptables. I found the code below on a different forum.   It's somewhat what I need to do. It includes _add_ and _remove_ options, but instead of `adduser` it needs to reflect the iptable rule such as   `iptables -I INPUT 1 -p tcp -s xxx.xxx.xx.xxx --dport 22 -m comment --**comment "testing for user1" -j ACCEPT`. The ip address itself needs to be passed as a parameter, so I can execute as   `./script 155.154.15.00` I am using RHEL version 6.4.   Any feedback is appreciated.               #!/bin/bash          clear       echo "########## MENU ############\n"       options=("add_user" "delete_user" "exit")       select opt in "${options[@]}"       do         case $opt in         "add_user")           clear           while [ 1 ]           do             clear             echo "1. Add user manually"             echo "2. Add user via TXT file"             read -p "Enter your choice" ch             case $ch in                1)                 read -p "Enter user name : " useradd                 read -p "Enter user password:" passwd                 echo -e "Successfully added the user"               ;;               2)               if [ $(id -u) -eq 0 ]; then                 for row in `more $1`                 do                   username=${row%:*}                   password=${row#*:}                       egrep "^$username" /etc/passwd >/dev/null                   if [ $? -eq 0 ]; then                     echo "$username exists!"                     exit 1                   else                     pass=$(perl -e 'print crypt($ARGV[0], "password")' $password)                     useradd -m -p $pass $username                     [ $? -eq 0 ] && echo "User has been added to system!" || echo "Failed to add a user!"                       fi                 done               else                 echo "Only root may add a user to the system"                 exit 2               fi                 esac             done         ;;         "delete_user")           read -p "Enter a User name to delete "UNAME           passwd           userdel $UNAME           echo "User $UNAME has been deleted"                     ;;         "exit")           break         ;;         esac       done


How do I make Kate indent with spaces on Python files but use tabs for text files and other files?

My goal is to set Kate up to work properly on Python files but to use different settings (tabs not spaces) on other documents. I'm sure others are doing this, but I can't figure out a convenient solution. I appreciate any advice. Kate has settings for indentation here:   1. Click the Settings menu   2. Click "Configure - Kate"   3. On the right expand "Editor"   4. Click "Indentation" One option is "Default indentation mode". One choice for that setting is Python. However, I cannot find where to set (or even display) the options used for the Python choice. Furthermore, it is not clear what is the interaction between "Default indentation mode" and the explicit settings for indentation on that page. Does one override the other?


How do I keep the .local TLD in my intranet

I use vagrant to launch VM's and bridge the network access to my local machine. Unfortunately exvery VM launch gives me a new IP address, and MAC address. I have a domain.local that I use and currently I have to change my computer's hosts file every launch to match. I have admin access to all the machines (local, VM, and the router for the intranet). How to I tell .local domains to resolve locally only in a way that won't require me to change (or set at all) my local hosts file?


Multiple bindings for the same action

Like many `screen` users I'm used to `Ctrl``a`, so on my machine I changed the binding to `Ctrl``a`, however, I wish to keep `Ctrl``b` since on some machines it's the default and when sharing work with other people this can be very confusing. I tried putting two lines in my `.tmux.conf` but only one of them will work.


get information about screen windows

I run two scripts simultaneously within `screen`. `screen` is started by a script. I am working on a method for automatic window selection depending on the state of the scripts. This works (`screen -S mysession select win1`) but for certain improvements I need information (i.e. a script need it thus interactive features are of little use) about the windows (and the processes within):   1. How can I determine the tty (`/dev/pts/xy`) that belongs to a certain window?   2. How can I determine which is the foreground / active window? Answering (1) would be possible by running `tty` after starting the new window and write its output somewhere. But a `screen`-internal solution would be more elegant and easier to implement (I guess). Interactively the commands `windowlist` and `windows` give the answer to (2) but I haven't managed to get this output as input into a script. Furthermore: Coding this information as highlighting is nice for the user but not so nice for a script.


Block specific IP from accessing gateway

Suppose you are on linux internet gateway/router. What would you do to block a client with specific IP using bash script. I prefer something like `./block_client.sh 192.168.1.123` to block and `./unblock_client.sh 192.168.1.123`


Changing parent directory (../) with symlinks

I have a symlink               ~/link -> ~/a/really/long/path      When I do               cd ~/link     cd ..          it takes me to               ~      but I want to go to               ~/a/really/long      Is there a way to do this? I am using bash.


How can I start Apache on Arch Linux w/systemd using passphrase protected SSL keys?

I'm relatively new to using Arch Linux and think I must be missing the obvious way to do this correctly, but –short of starting the daemon on my own– I can't figure out how to get passphrase protected SSL keys unlocked when starting the service normally. With unprotected keys or without the SSL configuration Apache starts normally using the systemd service. As soon as I try to use protected keys, I get something like this:               $ sudo systemctl start httpd     Job for httpd.service failed.          $ sudo systemctl status httpd     httpd.service - Apache Web Server        Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled)        Active: failed (Result: exit-code) since Mon 2014-02-10 11:47:07 UTC; 13ms ago       Process: 26035 ExecStop=/usr/bin/apachectl graceful-stop (code=exited, status=0/SUCCESS)       Process: 26042 ExecStart=/usr/bin/apachectl start (code=exited, status=1/FAILURE)      Main PID: 25500 (code=exited, status=0/SUCCESS)          systemd[1]: Starting Apache Web Server...     apachectl[26042]: Apache/2.2.26 mod_ssl/2.2.26 (Pass Phrase Dialog)     apachectl[26042]: Some of your private key files are encrypted for security reasons.     apachectl[26042]: In order to read them you have to provide the pass phrases.     apachectl[26042]: Server {name redacted}:443 (RSA)     apachectl[26042]: Enter pass phrase:Apache:mod_ssl:Error: Private key not found.     apachectl[26042]: **Stopped     systemd[1]: httpd.service: control process exited, code=exited status=1     systemd[1]: Failed to start Apache Web Server.     systemd[1]: Unit httpd.service entered failed state.      Is far as I can tell, Apache knows it needs to unlock my keys, but if systemd knows the passphrase prompt needs to be shown, any attempt to do so is not reaching my shell and silently failing. What is the best practice way (or Arch Way™) to start Apache and unlock protected SSL keys using systemd?


I have a 24 Gb disk and a 1Tb Hard Disk How do I get Ubuntu to install on my 24 GB and my home dir on the 1TB

I used the auto installer for Ubuntu on my 24GB drive my disk space looks like this.               kipke@ThePad:~$ df     Filesystem     1K-blocks    Used Available Use% Mounted on     /dev/sda2       16395648 3936132  11603608  26% /     none                   4       0         4   0% /sys/fs/cgroup     udev             2981788       4   2981784   1% /dev     tmpfs             598380    1100    597280   1% /run     none                5120       0      5120   0% /run/lock     none             2991888     236   2991652   1% /run/shm     none              102400      32    102368   1% /run/user     /dev/sda1         497696    3376    494320   1% /boot/efi         ![24gb drive picture](http://i.stack.imgur.com/tSWMV.png)    ![1tb drive picture](http://i.stack.imgur.com/yBnTZ.png)


What does "link#1" mean?

netstat -rn     Routing tables     Internet:     Destination        Gateway            Flags    Refs      Use    Mtu  Interface     default            75.126.68.49       UGS         7     1203      -   pcn0     1.2.3.3/29    link#1             UC          1        0      -   pcn0     ...      **My question** : What does "link#1" mean? The OS is OpenBSD.


Want to dual boot MBP with Linux

I just upgraded to a 1tb HDD in my MacBook Pro (non-retina) and would like to dual boot from OS X to a linux distro. I'd like to find out a few things so I can be better prepared and informed for this process. 1) Partitioning... Should I... a) Use BootCamp to create the second partition? b) Use Disk Utility to resizes and create the second partition? c) Create the partition from within the Linux live USB or DVD? 2) Which distro is recommended? I've used both Mint and Ubuntu in the past and definitely prefer distros based on Debian that use `apt-get` as opposed to the others like SUSE. 3) I've heard that it's a pain to get the wifi to work, is that true? If so, how to I enable the drivers? Is there an `apt-get` command I can use in order to do so? 4) Other than the wifi difficulties is there anything else I should be aware of and be prepared for?


FreeBSD: "Too many open files" but should be able to open another 160,000 files

I have a FreeBSD 8 system running ZFS, with a MySQL 5.5 server which is about 355GB and projected to grow to be a couple of Terabytes. MySQL is triggering errors about "Too many open files" on `/etc/hosts.allow`. We don't expressly use `/etc/hosts.allow`, but it is used by hosts_access(3) (`libwrap.a`), which is used by many things.               mysqld[1234]: warning: /etc/hosts.allow, line 15: cannot open /etc/hosts.allow: Too many open files      But when I check 't seem to be hitting any actual limits. The number of open files reported by `kern.openfiles stays` below 40,000 over a sustained period, and our limit is substantially higher:               # sysctl -a |grep files     kern.maxfiles: 204800     kern.maxfilesperproc: 184320     kern.openfiles: 38191          # ulimit -n     184320      Openfiles should be set to unlimited:               # grep openfiles /etc/login.conf         :openfiles=unlimited:\      MySQL says it should be able to open 184320 file handles:               # mysqladmin variables | grep open_files_limit     | open_files_limit                              |     184320                |      And some information from the perspective of the MySQL user. I stopped mysql and hacked `/usr/local/etc/rc.d/mysql-server` to print out these variables, so this should represent the MySQL environment. Note that the number 184320 is consistent with the above.               # /usr/local/etc/rc.d/mysql-server.stefantest start     Starting mysql.     cpu time               (seconds, -t)  unlimited     file size           (512-blocks, -f)  unlimited     data seg size           (kbytes, -d)  33554432     stack size              (kbytes, -s)  524288     core file size      (512-blocks, -c)  unlimited     max memory size         (kbytes, -m)  unlimited     locked memory           (kbytes, -l)  unlimited     max user processes              (-u)  5547     open files                      (-n)  184320     virtual mem size        (kbytes, -v)  unlimited     swap limit              (kbytes, -w)  unlimited     sbsize                   (bytes, -b)  unlimited     pseudo-terminals                (-p)  unlimited      And, for easy reference here are the descriptions for the sysctls:               kern.maxfiles: Maximum number of files     kern.openfiles: System-wide number of open files     kern.maxfilesperproc: Maximum files allowed open per process      **Related**   * This is possibly related to a ZFS on Nexenta question on ServerFault: Why is MySQL unable to open hosts.allow/hosts.deny?   * Also see this similar issue on the FreeBSD forums: [EMFILE] Too many open files


How to measure total disk I/O per hour

I have a cloud server were we get billed also for disk IO usage. Here is an example from the stats:               04/Sep/2013 07:24:19     04/Sep/2013 08:24:19     0,5 GB / 1 vCPU (0,08 Kr. per hour): Charge for 44.7578125GB disk I/O      So for one hour we get billed for around 45 GB disk I/O. To me that sounds like a lot of traffic and I would like to do some monitoring to check it myself. I know about tools like `dstat` and `sysstat` etc but I have not found any examples showing totals for one hour (or other timeframe). Most examples is averaging the results, like this command:               dstat -tdD total 60      Here, it shows disk I/O measuring for 60 seconds, but it is averaged. So if I copy a large file, I will see the number increase while copying, but as soon as it is finished, the number will decrease again. I other words, I don't end up with a true total for that period. **How can I log the total amount of disk I/O in a given timeframe?**


What file type categories do colors in the terminal represent in various distros (by default)?

I'm discovering new file type categories (if one can call different colors in the terminal in such a manner) almost on a daily basis. Still, I haven't found an exhaustive list of all recognized file types (compressed, pipe, directory, music, etc.) and the respective colors on the terminal, and that's a resource I'd appreciate to have. Is there a complete list for any Unix-based system? I'd like a full table for many distros, options, etc.; but if you'd give me a few really useful informative links, perhaps someone can add it up into a table (maybe this should be a community-wiki question, however, I can't mark it as such).


Oidentd problem with centos 6.5

I have installed oidentd and it is not working with ipv6s only, it works with ipv4 just fine. I have done some search on google and applied a patch on oidentd to work with ipv6 but i still cant make it to work. Here is the copy/paste.               root@mustang [~]# lsof -i -n -P | grep oidentd     oidentd 6065 nobody 6u IPv4 5906 0t0 TCP *:113 (LISTEN)     oidentd 6065 nobody 7u IPv6 5907 0t0 TCP *:113 (LISTEN)          telnet ::1 113     Trying ::1...     Connected to ::1.     Escape character is '^]'.      I also tried changing the value 0 to 1 in `/proc/sys/net/ipv6/bindv6only` still doesn't help. I even tried editing the setting in `/etc/init.d/oidentd` to execute oidentd with -a :: still nothing. All of my users are getting ~ symbol ifront of their ident. Here is one example               Nick is ~d34m0n@2607:5300:60:5177::21e3:4232 * ...      what am I missing? it's been a week and i am still scratching my head.