Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # OS X Terminal tips
- # Man pages as PDF (source: osxdaily.com)
- # If you’re tired of looking over a man page within the Terminal, you can launch any man page into Preview with the following command:
- man -t ipconfig | open -f -a /Applications/Preview.app
- # You can save to PDF from Preview for later reading
- # To open a terminal window by right-clicking on a Finder folder:
- # Go to System Preferences and click on “Keyboard”
- # Select the “Keyboard Shortcuts” tab and click on “Services” from the left menu
- # Scroll on the right until you see “New Terminal at Folder” and check the box next to it to enable the feature
- # Close System Preferences
- # To ensure a small amount of network activity happens on a regular basis
- ping -i 10 -q ADDRESS
- # -i 10 tells ping to wait 10 seconds between sending each packet, -q means quiet output (ADDRESS may be whatever IP or domain name you choose to ping)
- # Bash remembers the previous commands you input in "history" (actually they are stored in the file ~/.bash_history)
- # list the history entries
- $ history
- #delete the whole history
- $ history -c
- # delete a given entry
- $ history -d offset
- # How many lines is storing your history?
- $ echo $HISTSIZE
- # If your Terminal is losing the history (previously entered commands), try this:
- # Check first in your home directory the permissions and who owns the file .bash_history
- $ ls -al .bash_history
- # If for some reason the file is not owned by your username, will appear (for example) in the listing as:
- -rw------- 1 root staff 32 Jul 11 2011 .bash_history
- # Fix it with
- sudo chown [username] .bash_history
- # (source: http://www.paulmc.org/2009/01/enable-bash-history-in-terminal/ )
- # Now close Terminal, open it again and you should be capable of seeing previously entered commands by pressing the up arrow (that is, if you're using bash as your Terminal shell - - the default).
- # Make sure wich shell is running your Terminal (the above tips work in bash, BTW)
- $ echo $SHELL
- # OS X Lion Terminal
- # If you don't want Terminal to show the previous commands and window customizations on a new session (and you don't want to disable System Preferences > General > Restore windows when quitting and re-opening windows):
- $ defaults write com.apple.Terminal NSQuitAlwaysKeepsWindows -bool false
- # BTW, that "grey text" with the history is not the content of ~/.bash_history, it's stored in the folder
- $ ~/Library/Saved\ Application\ State/com.apple.Terminal.savedState/
- # Terminal shows the message 'You have mail':
- #You can access the mail by simply using the command
- mail
- #This launches you into Mail, and it will right away show you a list of messages that are stored there. If you want to see #the content of the first message, use
- t
- #This will show you the content of the first message, in full. You'll need to scroll down through the message to view it #all, by hitting the down-arrow key.
- #If you want to jump to the end of the message, use the
- #spacebar
- #If you want to abort viewing the message, use
- q
- #To view the next message in the queue use
- n
- #... assuming there's more than one message.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement