Return to site

Linux Commands For Mac

broken image

 

 

 

*Mac Os Commands

*Ubuntu Linux For Mac

*Linux Commands For Mac

*Linux Command For Machine

If you’re working in Terminal on your Mac, you need to know the most important UNIX commands: those that work with directories, those that work with files, and miscellaneous but commonly used commands.

Mac commands are rarely unique: most of them are inherited from Unix operating systems. If you’re familiar with one of the common Linux or Unix-like operating systems, you probably know all the basic MacOS commands you’ll need. Uniquely MacOS Commands. These commands are found only on Mac platform (and not Linux), some originating from BSD. If you’re working in Terminal on your Mac, you need to know the most important UNIX commands: those that work with directories, those that work with files, and miscellaneous but commonly used commands. Folders are called directories in UNIX. Commands that refer to filenames, as most do, assume that you’re talking about files in the. Find MAC Address on Linux The easiest way to find your MAC address on Linux is to execute the “ifconfig” command with the “-a” option for “all”. The MAC address is available in the “ ether ” section, concatening your OUI vendor and your OUI specific address.

Folders are called directories in UNIX. Commands that refer to filenames, as most do, assume that you’re talking about files in the working directory. When you open the Terminal window, the working directory is set to your home directory, abbreviated ~. Bash shows you the current working directory and your username to the left of its prompt. The following table lists common directory-related commands.Mac Os CommandsUNIX Directory CommandsCommandWhat It DoeslsLists the names of the files in the working directory. For morecomplete information, use ls –alF (.cd directorynameChanges the working directory to the one you named.cd ..Brings you up one directory level.cdReturns you to your home directory.pwdDisplays the pathname of the current directory.mkdir newdirectorynameMakes a new directory.rmdir directorynameRemoves (deletes) an empty directory.

As in Windows, you can redirect the output of a command to a text file. So if you want a record of the files in a folder, type cd, followed by a space, drag the folder’s icon to the Terminal window, and press Return. Type ls > mydirectorylist.txt and press Return again. A file named mydirectorylist.txt will appear in the folder you chose. You can open the file in TextEdit to see a list of the files in that directory.

This table lists commands commonly used when working with files in the Terminal window.Working with FilesCommandWhat It Doescp filename1 filename2Copies a file.chmodChanges permissions for access to a file. Study the man pagebefore using this one.diffCompares two files line by line (assumes text).more filenameDisplays a text file one page at a time. Press the spacebar tosee the next page; press Q to quit. The man command works throughmore.mv filename1 filename2Moves a file or changes its name.rm filenameRemoves (deletes) a file.

This last table explains other handy commands that anyone getting started in Terminal will likely want to know.Miscellaneous CommandsCommandWhat It DoesControl+CTerminates most operations.dateDisplays the current date and time.echoRepeats whatever appears after the command (afterexpansion).helpDisplays a partial list of bash commands.historyDisplays the last commands you typed. You can redo a command bytyping an exclamation point (!) followed immediately (no space) bythe number of that command in the history list. To repeat the lastcommand, type !!. To repeat the last filename, type!*.picoA simple UNIX text editor.psDisplays a list of running processes.sudoLets you carry out commands for which the account you are usinglacks authority. You will be asked for an administrator’spassword.Ubuntu Linux For Mac

When you’re working in Terminal, you don’t have a Trash Can to which deleted files are moved pending ultimate disposal. Delete it, and it’s gone. In general, UNIX has no Undo function.

arp command manipulates the System’s ARP cache. It also allows a complete dump of the ARP cache. ARP stands for Address Resolution Protocol. The primary function of this protocol is to resolve the IP address of a system to its mac address, and hence it works between level 2(Data link layer) and level 3(Network layer).

Syntax:

Example: Here we created two machines with name machine1 and machine2 with IP address 10.0.2.4 and 10.0.2.5

*Screenshot of hosts before adding

*Addition of host

*Hosts file after adding machines

*Now checking arp for all

Options:

*-v, –verbose: This option shows the verbose information.

*-n, –numeric: This option shows numerical addresses instead of symbolic host, port or usernames.

*-H type, –hw-type type, -t type: This tells arp which class of entries it should check for. Default value is ether. List of possible hardware types(which support ARP) are ash(Ash), ether(Ethernet), ax25(AMPR AX.25), netrom (AMPR NET/ROM), rose (AMPR ROSE), arcnet (ARCnet), dlci (Frame Relay DLCI), fddi (Fiber Distributed Data Interface), hippi (HIPPI), irda (IrLAP), x25 (generic X.25), eui64 (Generic EUI-64).

*-a [hostname] –all: This option is used for showing entries of the specified host. If nothing is passed all entries will be displayed.

*-d hostname, –delete hostname: Removes any entry for the specified host. If any host is down, there is no need of keeeping its entry in arp cache so this command is used to delete those entries explicitly by the user.

*-D, –use-device: Use the given interface’s hardware address.

*-e: Shows the entries in default(Linux) Style.

*-i If, –device If: Select an interface. When dumping the ARP cache, only entries matching the specified interface will be printed.

Note: This has to be different from the interface to which the IP datagrams will be routed.

*-s hostename hw_address: Manually create an ARP address mapping entry for the host hostname with its mac address as hw_address.

*-f filename: Works same as -s but instead of giving the entries manually, it takes entry from the file given as parameter.

Some useful flags are: 

*-C: Complete entry.

*-M: Permanent entry.

*-P: Published entry.

Some useful file related to these data are:

*/proc/net/arp

*/etc/networks

*/etc/hosts/

*/etc/ethersRecommended Posts:

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.Linux Commands For Mac

Please Improve this article if you find anything incorrect by clicking on the 'Improve Article' button below.Linux Command For Machine

 

 

 

 

broken image