This tutorial describes how to make use of the macOS Terminal to make your life easier. A folder named Sites which holds the wordpress folder expanded from download. NOTE: To change maxfiles on Sierra, define a plist. How do I create or write to images to disk on Apple Mac OS X (macOS) Unix operating. Open the Terminal application and type the following command to list disks. So if you want to download external and fat app go here.
This tutorial is for beginner users who want to learn the basicsof how to use the command line.Here's another basic command line tutorialwith more information, if you'd like to learn more.
- Finding the Command Line
- Neat Tricks
What Is the Command Line?
The command line is the ultimate seat of power on your computer. Using the command line, you can perform amazing feats of wizardry and speed, taming your computer and getting it to do precisely what you want. Unfortunately, the price of this power is complexity: nobody ever said that ruling your computer would be easy.
The command line is, at its heart, simply a place where you type commands to the computer. The computer is your obedient servant, and will attempt to carry out any command that it understands. Unfortunately, the computer does not speak English, or any other language spoken by humans (although it has recognizable elements). In order to give it commands, we must first start learning the language of the computer.
NOTE: The command line, as with all power, has its risks.You have the capability to instruct the computer to do anything it has the capability of doing. If you instruct the computer to erase all of your data, it will cheerfully proceed to do so. Do not run a command just to see what it does. Make sure you understand what the command is supposed to do first, especially if the command involves changing or removing files.
Finding the Command Line
Most people don't use the command line on a regular basis, so it can be a bit difficult to find the first time. The Windows operating system doesn't even have a proper command line built in — to execute these commands, you will have to install one.
Mac OS X
The Mac command line is a program called Terminal. It lives in the
/Applications/Utilities/
folder. To find it, go to yourApplications folder. Near the bottom, there is a folder called Utilities. Go inside, and one of the applications listed is called Terminal. Double-click that application to open it.
Linux
The location of the command line depends on whether you are using the Gnome or KDE window manager. (If there is a big K icon on the bottom left of the screen, you are using KDE; if not, you are using Gnome.) If you are using KDE, click the K button, select System, and click on Konsole. If you are using Gnome, click the Applications button at the top left, select System Tools, and click on Terminal.
Windows
Unfortunately, you will have to install your own command line program. Windows comes with a command line, but it is non-standard and more difficult to use.Babun is a free, easy to install command line program. Simply download the Babun installer, double-click it to install Babun, and then move the installer to the recycle bin. To use Babun, go to the Start menu, select Programs, and click on Babun.
Command Syntax
Nobody likes grammar, so let's get this over with quickly. All commands have three parts: the utility, the flags, and the arguments. The utility always comes first. The other two parts have different rules, depending on which command you are using: you may not have to use any flags or arguments at all.Here is a sample command that you might type into a command line:
Let's break this command down into parts:
ls
is a utility. Utilities are also sometimes known as commands all on their own, because they indicate the general idea of what you want. Most of the time, you can simply run a utility all by itself, without any flags or arguments. Most commands only have one utility.-l
is a flag that alters how the utility operates. Flags are like options or preferences: the utility will usually work perfectly well with the defaults, but sometimes, you want to modify how it works slightly. Flags always start with either one or two dashes (-
), and they usually come between the utility and the arguments.~/Desktop
is an argument to the utility. Arguments are used when the utility needs to know exactly what you want for a certain action, and there is no clear default setting. You can think of it more like a conversation than an argument: The utility says 'I don't know how I should do this!', and you use an argument to say, 'Here, this is how you should do it.' Arguments usually come at the end of the command, after the utility and the flags (if any flags are used). The number of arguments used generally depends on the utility: some don't need any arguments, some require exactly one argument, some require lots of arguments, and some are flexible in the number of arguments they can take.
This command uses the
ls
utility, which is used to list the contents of directories. We use the -l
flag to indicate to the utility that we want more information than it usually provides, and so it should show us the directory contents in a long format (-l
is short for 'long'). Last, the utility wants to know, 'But which directory should I list the contents of?' Using the argument, we reply, 'Show me the contents of my Desktop.'
In all cases, to submit a command to the computer, press enter. Now, let's start learning some useful commands!
Basic Utilities
Here is a list of basic utilities that you will use on a regular basis. Anything in capital letters that starts with a dollar sign, like
$THIS
, is an argument to the utility. You should replace $THIS
with the actual argument you want to give the computer.
manual. Get information for how to use any utility. Replace
$UTIL
with any utility, like ls
, cd
, or even man
! Press the up and down arrows to scroll through the documentation. Press Q to quit and go back to the command line.
list. Lists the contents of the directory
$DIR
. If no directory is specified, lists the contents of the current working directory. Use the -l
flag to get more information.
change directory. Changes the current working directory to the directory
$DIR
. In effect, moves you around the computer.
print working directory. If you ever get lost in the computer, run this command to get a trail of breadcrumbs all the way down from the top level of the computer to see where you are.
Displays the contents of a file. Press the up and down arrows to scroll though the file. Press Q to quit and go back to the command line.
copy. Copies the
$FILE
to the $LOCATION
.
move. Moves the
$FILE
to the $LOCATION
.
remove. Deletes a file permanently: there is no way to get it back. Be careful when using this command!
super user do. When you use this utility, you use an entire command as a single argument: for example,
sudo ls -l ~/Desktop
. sudo
asks for your user account password. As a security measure, the screen does not display anything as you type, not even asterisks (*
). If the password is typed in correctly, sudo
executes the $CMD
with elevated permissions. Be careful when using this command!
A note about using
sudo
: The computer has a few built-in safety restraints to prevent normal users from doing bad things, like deleting critical files. The super user has no such restraints. Note that the super user is not necessarily bad: you must use sudo
to install programs and do anything else that affects how your computer runs.
Moving Around the Computer
Lets start by using
ls
to look around your computer. Try typing ls
into the command line and pressing enter. The computer will reply with a list of names. These names are the names of files and folders in the directory you are currently in. Whenever you open up a new command line, you start in your home directory, which is the directory that generally contains all of your files.
Well, that's nice. But what if we want to go someplace else? That's what
cd
is for. cd
requires an argument: if you tell the computer you want to go somewhere, you also have to tell it where you are going. Try entering this command:
Remember, to press enter once you have finished typing. The computer will not reply, but you are now sitting in your Documents directory. You can test this by running
ls
again: the list of names will be different.
So where do we go from here? How do we know which of these names are folders (that we can go into) and which are files (that we can't)? For that, we need more information from the ls command. Let's give it the
-F
flag to tell us about files and folders. Try entering this command:
You will notice that this time, some of the names that the computer returns to you will have a slash after them. These names are folders: the rest are files. You can always cd into a folder by running cd with the folder name as an argument, as long as you can see that folder with
ls -F
.
When you're done looking in folders, it's time to go back up. But how? Luckily, every folder contains a hidden link back up. To see these hidden links, we will use the
-a
flag for ls to see all. There are at least two hidden links in every folder. The .
(one period) link takes you back to the same folder you are currently in — it doesn't take you anywhere. The ..
(two periods) link takes you back up to the parent folder. In fact, you can give the ls
command multiple flags, like so:
If you run this command, you will notice that the
.
and ..
hidden links have slashes next to them, which means you can use them with cd! To go back up a folder, you can always run:
Remember that if you ever get lost in the computer, you can run
pwd
to see where you are.
Neat Tricks
Computer programmers are lazy. Because they are lazy, they invented some techniques to do more with less work. Here are some of those techniques:
Tab Autocompletion
Whenever you need to type out a location in an argument (for example, in the
cd
command), you don't have to type out the whole thing: the first few letters will do. Once you've typed three or four letters, press the tab key, and the command line will fill in the rest for you! For example, if you are in your home directory, and you type cd Desk
and then press the tab key, the command line will automatically complete the command to read cd Desktop
! You can also use this if you find yourself mistyping folder names: tab autocompletion will always fill it in correctly.
Shortcuts
The command line has a few shortcuts built in. For example, to see your previously typed command, just press the up button. You can do this to submit the same command multiple times, or to edit a command that you didn't type in quite right. Another shortcut: you can use
~
(tilde) to refer to your home directory: cd ~
will take you back there.
Warnings
Remember, when you use the command line, the computer will cheerfully do anything it can for you. If you ask it to do something bad, it will try to do so. Some people take advantage of this fact by telling novice command line users to run commands that do nasty things to your computer. Here are a few to watch out for. Never run any of these commands! They can and will destroy your computer!
The command to remove a file is
rm
. You can also use rm
to remove multiple files at a time. This command tells the computer to start at the top of the file structure, and delete every single file on the computer without stopping. After this command has run, your computer be empty. If you turn it off, it will not be able to turn back on until you reinstall an operating system on it.
This interesting-looking piece of code is called a fork bomb. Like a virus, it will continually multiply and subdivide itself, asking for more and more resources from the computer, until the entire computer is trying to process this code. As a result, the computer has no resources left for any other programs or processes, and will freeze or crash. Fortunately, rebooting your computer should cure it.
Please enable JavaScript to view the comments powered by Disqus.
El terminal es una herramienta muy potente con la que podremos realizar algunas operaciones de forma mucho mas ágil en comparación con el entorno gráfico, incluso podremos realizar tareas que no están contempladas desde el entorno gráfico.
Por ello he decido poner un resumen de todos los camando que podemos utilizar en el Terminal de Mac OS X con el propósito de que muchos de que no le tengamos el miedo al terminal y comencemos a explorarla mediante la utilización algunos de estos comandos.
Hay que tener en cuenta que la ejecución de ciertos comandos nos solicitara el password, siendo en dicho momento cuando nos identificaremos como superusuario, tener cuidado ya que con dichos comandos podemos comprometer nuestro sistema.
An A-Z Index of the Apple OS X command line
- alias Create an
- alloc List used and free memory
- apropos Search the whatis database for strings
- awk Find and Replace text within file(s)
- basename Convert a full pathname to just a filename
- bash Bourne-Again SHell
- bg Send to background
- bind Display readline key and function bindings
- bless Set volume bootability and startup disk options.
- break Exit from a For, While, Until or Select loop
- builtin Execute a shell builtin
- bzip2 Compress or decompress files
- cal Display a calendar
- calendar Reminder Service
- caller Return the context of a subroutine call
- case Conditionally perform a command
- cat Concatenate and print (display) the content of files
- cd Change Directory
- chflags Change a file or folder’s flags
- chgrp Change group ownership
- chmod Change access permissions
- chown Change file owner and group
- chroot Run a command with a different root directory
- cksum Print CRC checksum and byte counts
- clear Clear terminal screen
- cmp Compare two files
- comm Compare two sorted files line by line
- command Run a command (not a function)
- complete Edit a command completion [word/pattern/list]
- continue Resume the next iteration of a loop
- cp Copy one or more files to another location
- cron Daemon to execute scheduled commands
- crontab Schedule a command to run at a later date/time
- csplit Split a file into context-determined pieces
- curl Transfer data from or to a server
- cut Divide a file into several parts
- date Display or change the date & time
- dc Desk Calculator
- dd Data Dump – Convert and copy a file
- declare Declare variable & set attributes
- defaults Set preferences, show hidden files
- df Display free disk space
- diff Display the differences between two files
- diff3 Show differences among three files
- dig DNS lookup
- dirname Convert a full pathname to just a path
- dirs Display list of remembered directories
- diskutil Disk utilities – Format, Verify, Repair
- disown Unbind a job from the current login session
- ditto Copy files and folders
- dot_clean Remove dot-underscore files
- drutil Interact with CD/DVD burners
- dscacheutil Query or flush the Directory Service/DNS cache
- dseditgroup Edit, create, manipulate, or delete groups
- dsenableroot Enable root access
- dsmemberutil View user and groups rights
- dscl Directory Service command line utility
- du Estimate file space usage
- echo Display message on screen
- ed A line-oriented text editor (edlin)
- enable Enable and disable builtin shell commands
- env List or Set environment variables
- eval Evaluate several commands/arguments
- exec Execute a command
- exit Exit the shell
- expand Convert tabs to spaces
- expect Programmed dialogue with interactive programs
- Also see AppleScript
- export Set an environment variable
- expr Evaluate expressions
- false Do nothing, unsuccessfully
- fc Fix command (history)
- fdisk Partition table manipulator for Darwin UFS/HFS/DOS
- fg Send job to foreground
- file Determine file type
- find Search for files that meet a desired criteria
- fmt Reformat paragraph text
- fold Wrap text to fit a specified width
- for Loop command
- fsck Filesystem consistency check and repair
- fsaclctl Filesystem enable/disable ACL support
- fs_usage Filesystem usage (process/pathname)
- ftp Internet file transfer program
- GetFileInfo Get attributes of HFS+ files
- getopt Parse positional parameters
- getopts Parse positional parameters
- goto Jump to label and continue execution
- grep Search file(s) for lines that match a given pattern
- groups Print group names a user is in
- gzip Compress or decompress files
- halt Stop and restart the operating system
- hash Refresh the cached/remembered location of commands
- head Display the first lines of a file
- hdiutil Manipulate iso disk images
- history Command History
- hostname Print or set system name
- iconv Convert the character set of a file
- id Print user and group names/id’s
- if Conditionally perform a command
- ifconfig Configure network interface parameters
- ipconfig View and control IP configuration state
- info Help info
- install Copy files and set attributes
- jobs List active jobs
- join Join lines on a common field
- kextfind List kernel extensions
- kickstart Configure Apple Remote Desktop
- kill Stop a process from running
- l List files in long format (ls -l)
- last Indicate last logins of users and ttys
- launchctl Load or unload daemons/agents
- ll List files in long format, showing invisible files (ls -la)
- less Display output one screen at a time
- let Evaluate expression
- lipo Convert a universal binary
- ln Make links between files (hard links, symbolic links)
- local Set a local (function) variable
- locate Find files
- logname Print current login name
- login log into the computer
- logout Exit a login shell (bye)
- look Display lines beginning with a given string
- lpr Print files
- lprm Remove jobs from the print queue
- lpstat Printer status information
- ls List information about file(s)
- lsregister Reset the Launch Services database
- lsbom List a bill of materials file
- lsof List open files
- man Help manual
- mdfind Spotlight search
- mdutil Manage Spotlight metadata store
- mkdir Create new folder(s)
- mkfifo Make FIFOs (named pipes)
- more Display output one screen at a time
- mount Mount a file system
- mv Move or rename files or directories
- nano Simple text editor
- net Manage network resources
- netstat Show network status
- networksetup Network and System Preferences
- nice Set the priority of a command
- nohup Run a command immune to hangups
- ntfs.util NTFS file system utility
- onintr Control the action of a shell interrupt
- open Open a file/folder/URL/Application
- opensnoop Snoop file opens as they occur
- osacompile Compile Applescript
- osascript Execute AppleScript
- passwd Modify a user password
- paste Merge lines of files
- pbcopy Copy data to the clipboard
- pbpaste Paste data from the Clipboard
- ping Test a network connection
- pkgutil Query and manipulate installed packages
- plutil Property list utility
- pmset Power Management settings
- popd Restore the previous value of the current directory
- pr Convert text files for printing
- printenv List environment variables
- printf Format and print data
- ps Process status
- pushd Save and then change the current directory
- pwd Print Working Directory
- quota Display disk usage and limits
- rcp Copy files between machines
- read Read one line from standard input
- readonly Mark a variable or function as read-only
- reboot Stop and restart the system
- return Exit a function
- rev Reverse lines of a file
- rm Remove files
- rmdir Remove folder(s)
- rpm Remote Package Manager
- rsync Remote file copy – Sync file tree (also RsyncX)
- say Convert text to audible speech
- screen Multiplex terminal, run remote shells via ssh
- screencapture Capture screen image to file or disk
- sdiff Merge two files interactively
- security Administer Keychains, keys, certificates and the Security framework
- sed Stream Editor
- select Generate a list of items
- set Set a shell variable = value
- setfile Set attributes of HFS+ files
- shift Shift positional parameters
- shopt Set shell options
- shutdown Shutdown or restart OS X
- sips Scriptable image processing system
- sleep Delay for a specified time
- softwareupdate System software update tool
- sort Sort text files
- source Execute commands from a file
- split Split a file into fixed-size pieces
- stop Stop a job or process
- su Substitute user identity
- sudo Execute a command as another user
- sum Print a checksum for a file
- suspend Suspend execution of this shell
- sw_vers Print Mac OS X operating system version
- system_profiler Report system configuration
- systemsetup Computer and display system settings
- tail Output the last part of files
- tar Tape ARchiver
- tcpdump Dump traffic on a network
- tee Redirect output to multiple files
- test Condition evaluation
- textutil Manipulate text files in various formats (Doc,html,rtf)
- time Measure Program Resource Use
- times Print shell & shell process times
- top Display process information
- touch Change file timestamps
- tr Translate, squeeze, and/or delete characters
- trap Execute a command when the shell receives a signal
- traceroute Trace Route to Host
- true Do nothing, successfully
- tty Print filename of terminal on stdin
- type Describe a command
- ufs.util Mount/unmount UFS file system
- ulimit limit the use of system-wide resources
- umask Users file creation mask
- umount Unmount a device
- unalias Remove an alias
- uname Print system information
- unexpand Convert spaces to tabs
- uniq Uniquify files
- units Convert units from one scale to another
- unset Remove variable or function names
- until Loop command
- uptime Show how long system has been running
- users Print login names of users currently logged in
- uuencode Encode a binary file
- uudecode Decode a file created by uuencode
- uuidgen Generate a Unique ID (UUID/GUID)
- uucp Unix to Unix copy
- vi Text Editor
- wait Wait for a process to complete
- wc Print byte, word, and line counts
- whatis Search the whatis database for complete words
- where Report all known instances of a command
- which Locate a program file in the user’s path
- while Loop command
- who Print all usernames currently logged on
- whoami Print the current user id and name (`id -un’)
- write Send a message to another user
- xargs Execute utility – passing arguments
- yes Print a string until interrupted
- !! Run the last command again