Tag Info

New answers tagged

2

If you insert echo "prevexit=3" > ~/.prevexit at the end of your crontab initiated command, then you can use: source ~/.prevexit close to the top of all the scripts that need to include the value, and use it in the rest of those scripts as $prevexit. You should of course replace 3 with the real value you want to share.


0

Appears to be down to a weird character appearing in the .profile.


1

Try moving [[ $TERM != "screen" ]] && exec tmux to your .zshrc file. That way the command will only be run in interactive shells. An interactive shell is simply any shell process that you use to type commands, and get back output from those commands. That is, a shell with which you interact.


0

This isn't a keyboard problem, rather it is an output problem. Some font you're using probably has the ASCII code for vertical bar mapped to รถ . Try a different font and see if the problem goes away.


1

When grepping a disk - unless you're actually looking for non-printable information - you might like to do: tr -c '[:print:]\n' '\n\n' </dev/disk | grep -b 'regex' All binary data is converted to newlines and grep can simply ignore it except to increment the offset it reports on by one.


-1

I noticed a few gotchas when grepping disk devices which I noted here with a helper script: http://www.pixelbeat.org/docs/disk_grep.html


2

I started using @Gilles's answer, but found that if the terminal changed the number of columns the prompt would no longer be at the start of a line as expected. This can happen for a variety of reasons, including tmux/screen splits, manual resizing of a GUI container, font changes, etc. What I really wanted was something that would add a newline if the ...


5

If the filesystem takes over the whole disk, OS X currently uses a name like /dev/disk5. If the disk is partitioned, it adds an s# suffix, like /dev/disk5s2 for the second partition. (s is short for "slice," a BSDism functionally equivalent to a partition.) Disks are numbered sequentially in discovery order by the OS, on boot, so you may have to experiment ...


0

The cause of this problem was lack of documentation of the Arch Linux install on a Macbook 10.1. This is how i resolved my issues: The first cause of the problem was a missing ext4 driver, so i simply copied that over as explained in the rEFInd documentation. The seconds cause, was incorrect documentation from the arch linux wiki. The lines which are ...


3

To my knowledge /dev/shm is a Linux-only feature. I just doubled checked on my OSX 10.9.4 system and it definitely does not have /dev/shm. Now given OSX is rooted in Unix I would be very surprised if it did not have something similar, so searching for the equivalent led me to this SO Q&A titled: Does OS X have an equivalent to /dev/shm?, which in turn ...


2

I found this tutorial. It's untested by me but several commenters to the article attested to it working. The article is titled: Mount a ufs2 Volume in MacOS/X 10.7 (Lion). excerpt If you have to mount an ufs2 volume (for example an external FreeNAS disk) in MacOS/X Lion, you can do the following: Download and install OSXFUSE from ...


0

You can give nmap a range: $ nmap -sn 138.0.0.0/24 $ nmap -sn 138.0.0.0-255 The -sn flag means to just ping the host and return (i.e. no port scan like nmap usually does). Edit: After reading the comments I see that bahamat mentions arp. In fact, arp with no arguments runs faster than nmap for me, and finds everything connected to my LAN: $ time arp ...


1

Installation of ruby can be easily done using curl: curl -sSL https://get.rvm.io | bash and is listed in the main rvm site here. After this operation is complete type rvm in the command line to check if it installed properly and if it did, it lists out its usage and other things. Ruby is usually pre-installed in most linux ditributions. To check ...


0

Yes, OS X is UNIX. "UNIX" is really just a trademarked name, applied by The Open Group, upon completion of a certification. Many different - not at all compatible - OSes are certified as a UNIX. OS X among them. Here is the current certification page for OS X 10.9 "Mavericks" as "UNIX 03" certified: ...


2

The -i switch causes sed to edit the original file. That means there is no output and since there is no output, your redirection results in an empty file. So, what you want is either sed -i '' 's/$/<@string>/' txt.txt which will change the original txt.txt. Or, just sed 's/$/<@string>/' txt.txt > txt2.txt


8

If you don't want to be challenged every time for your password then I'd recommend setting it to NOPASSWD in your /etc/sudoers file rather than hardcode your password in your logins. At least this way your primary login's password will remain intact and not be completely exposed in your .bashrc. To make this change run the command sudo visudo, and change ...


0

The drive may become slow because of unstable sectors (that's sectors that the drive cannot currently read, but may become readable after being overwritten or reallocated). I observed this in an external drive myself. In my case, the unstable sectors caused I/O errors in a frequently used part of the filesystem. While no file appeared to fail, the transfer ...


0

A workaround is to keep writing something to the socket - once data can't be written nc will exit. (echo -ne "GET / HTTP/1.0\r\n\r\n"; (while true; do echo -e "\n"; sleep 1; done)) | nc example.com 80 This will send empty line to nc once every second until nc can't write to socket and nc will exit. Thanks to Steffen Ullrich for his answer and comments ...


1

The default behavior of nc is to close the connection if stdin is closed. To change you can use the -q option (like -q -1) on Linux, it might be the same on OS X. See the man page for details. Edit: looks like OS X nc does not support -q switch or anything similar. In this case you need to make sure that stdin gets not closed by doing somehing like this: ( ...


0

Apparently your DISPLAY variable is not being recognized. Run Display via: DISPLAY=:0 Display someimage.jpeg If that works, it is an indication your export is not working correctly. Before running the command, what is the output of echo $DISPLAY?


1

Can't you do it from Finder? Also please make sure the external drive is really OSX Extended Journal. It appears it is either NTFS or FAT32.


0

With the screen option -L, you can switch on logging of the output to files named screenlog.n with n the index of the window. The problem is that one of your programs terminates, either normally, or by an error. If the program exits, screen will close the window, that's normal. If the program exits on an error, it may show a message before exiting, which ...


1

If you have space, please back up the disk as a whole (e.g. dd if=/dev/sdb of=disk.img bs=1M), before running random programs like fsck on things that you don't think are valid partitions :p. I'm not saying you've damaged it, but there's a very good chance of doing so while experimenting. The partition table shown by parted & the kernel looks ...


1

try do some example, your system supports chained symlinks, for example cd ln -s /bin/ls myls1 ln -s myls1 myls2 ln -s myls2 myls3 start experiment: ./myls1 should work ./myls2 works or not? ./myls3 works or not? When myls3 works, your system supports chained symlinks. I don't belive it doesn't :) Then I think problem is not with symlinks, but with ...


1

It's kind of one of those things you just have to experience to really understand it. For one, the community is really supportive and educated. You don't get as many of the "Why do you even want to know that?" reactions out of Linux users that you do with users/developers of other operating systems. I would suggest just using it for a few months and getting ...



Top 50 recent answers are included