Tag Info

Hot answers tagged

62

From your other questions I take it you're using OS X. The default HFS+ filesystem on OS X is case-insensitive: you can't have two files called "abc" and "ABC" in the same directory, and trying to access either name will get to the same file. The same thing can happen under Cygwin, or with case-insensitive filesystems (like FAT32 or ciopfs) anywhere. ...


15

Because builtins are part of the shell. Any bugs or history they have are bugs and history of the shell itself. They are not independent commands and don't exist outside the shell they are built in. The equivalent, for bash at least, is the help command. For example: $ help while while: while COMMANDS; do COMMANDS; done Execute commands as long as a ...


7

You can remove the first 12 lines with: tail -n +12 Some implementations of head like GNU head support: head -n -12 but that's not standard. tail -r file | tail -n +12 | tail -r would work on those systems that have tail -r (see also GNU tac) but is sub-optimal. Where n is 1: sed '$d' file You can also do: sed '$d' file | sed '$d' to remove 2 ...


3

While it's true that some shell builtins may have a scant showing in a complete manual - especially for those bash-specific builtins that you're only likely to use on a GNU system (the GNU folks, as a rule, don't believe in man and prefer their own info pages) - the vast majority of POSIX utilities - shell builtins or otherwise - are very well represented in ...


3

Just wanted you to know that I found a solution to avoid the now famous "30 seconds wait" ;-) I have a Mid-2012 MacBook Air. I tried all your mentionned solutions to speed up the boot under Yosemite, but the best one to me was to change the refind folder name on the EFI partition, and also rename the refind file. So, it gives : By security, I added all ...


2

find's -delete flag works similar to rmdir when deleting directories. If the directory isn't empty when it's reached it can't be deleted. You need to empty the directory first. Since you are specifying -type d, find won't do that for you. You can solve this by doing two passes: first delete everything within dirs named __pycache__, then delete all dirs ...


2

There might be simpler ways, but when I have encounterd the Mac's filesystem to behave against my (Unix) expectations I moved the files that I need to a new directory, remove the old one and renamed the new directory to the old one. cd .. mkdir tmptest mv test/*.py tmptest rm -rf test mv tmptest test I am not sure what causes this except that it probably ...


2

You can use the following way to remove first N lines and last M lines. With N=5, M=7 and file test.txt: sed -n -e "6,$(($(wc -l < test.txt) - 7))p" test.txt The command prints all lines from N+1 to LastLine-M. Another option is to use python: python -c 'import sys;print "".join(sys.stdin.readlines()[5:-7]),' < test.txt


2

On OS X you should use launchd. To implement it, I will explain with an example. Go to folder /Users/your-username/Library/LaunchAgents and save there the following plist file. I named it com.username.testscript.plist, but feel free to change it. <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" ...


1

You are using the ~/Applications/ Folder and Not /Applications. Try: cd /Applications And then: ls ~ Means home, which is /Users/user/. There is a users Application folder but it is very rarely used and it is for Applications that are installed for only that certain user. All default Applications are in /Applications.


1

It can be a bit of a hunt to find this info. Some options are: Read the Documentation If you run top -v you'll see the line procps-ng version x.x.x procps-ng is the package that contains top along with other tools such as ps. You can read the licence for the procps-ng package in /usr/share/doc/procps-ng-<x.x.x>/COPYING In this case, it's a copy of ...


1

get is a legal sftp command, but can't be used that way. The correct syntax to download filename.tar.gz to your Mac is: sftp user@host:/path/to/filename.tar.gz /some/local/folder (Replace user with the user you use to connect to the remote server, replace host with the remote server name.) There's nothing special to tar.gz files in the above command, it ...


1

You can use crontabs as usual on OS X, with the minor difference that the per-user files are in /usr/lib/cron/tabs/. The corontab command knows how to access them. Note that the cron daemon doesn't run by default on OS X, but launchd will start it if there are any files in /usr/lib/cron/tabs/, or if /etc/crontab exists. Speaking of launchd: as @jherran ...


1

There are a couple potential reasons for this. 1) You told it to delete directories only (-type d), and those directories still have files inside them. 2) Your directories only contain other directories, so the -type d will take care of the contents issue. However you are using OS-X, which is largely based on FreeBSD, and the FreeBSD find by default will ...


1

You can do this with ls, sort, tail and cut. Start with renaming bash_history to bash_history 1 so all files have a number. Then run the following to copy the next file: #!/bin/bash D=~/Desktop/Coding/Bash\ Histories num=$(ls "$D" | cut -d ' ' -f 2 | sort -nr | head -1) num=$(( num + 1 )) cp ~/.bash_history "$D/bash_history $num" The ls $D just lists ...


1

As in the first answer you have run various commands with the elevated command, sudo, in your personal space. Now you have directories in your personal space that are owned, not by you, but by root. If you type cd with no parameters you'll be taken to the bottom of your personal space (where it starts) and be able to see it with the pwd command. On many ...


1

Yes it does, because rEFInd doesn't work because of corestorage. The entire disk, that means all partitions, is/are managed as a single volume, and rEFInd is lost in this "several partitions on multiple drives as a single logical volume". So you have to choose between corestorage performance, or rEFInd. Your options: install rEFInd into an another HFS ...



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