Symbol A Practical Guide To Unix For Mac

The main goal of this document is to provide sufficient information on basic Linux and shell scripting usage to get started on introductory exercises. By the end of you should be able to launch commands from the command-line, compose commands using pipes, and navigate in the filesystem. By the end of you should be able to write basic shell scripts to perform repetitive operations. The context of this guide are under-graduate and post-graduate courses at Heriot-Watt University, Edinburgh, that rely on basic knowledge of Linux usage.

In particular, this guide should provide sufficient context for assignments in the courses F21CN Computer Network Security and F21SC Industrial Programming. However, it should be of broader use, and it is designed for such. Linux Quick Reference Before you start the tutorial, proper, it is strongly recommended that you get this (O'Reilly). First of all, make sure that you have your username and password ready. You will get these at induction day. If you missed that opportunity, (room EMB 1.33). Now, work through, which takes you through the first steps of logging in and basic Linux command-line usage.

By the end of this section, you should be able to launch commands from the command-line and get help on the most common activities. Then, work through, which teaches you basic shell usage in bash and takes you through a couple of exercises. It starts with simple straight-line scripts, i.e. Sequences of commands that are executed as if typed on the command line, and moves on to repetitive scripts, e.g.

Using loops and function calls. Finally, to deepen your understanding, look at the examples in, save the examples in separate files, and execute the files as discussed.

Make small changes to the scripts to modify behaviour. By the the end of this section, you should be able to write basic shell scripts, to automate repetitive processes. For further practicals beyond the scope of this tutorial, check the section below, in particular look-up the detailed 3-part online. If you prefer a comprehensive textbook, covering the range of basic to advanced Linux usage, with many examples and a fairly complete command reference, check out. All exercises in this tutorial are shown in a format like this: $ pwd /home/hwloidl The lines starting with $ are executable commands all other lines are the output of running this command. The $ symbol stands for the prompt you see in your terminal window.

To do the exercise, cut-and-paste the text after the $ symbol into your terminal window. For example, when you cut-and-paste the command pwd from the example above, you will get the current directory as a reply. Lines starting with # are comments, explaining what the commands are doing, and can be ignored. Try variants of the commands as shown in the introduction to understand what's happening in each step. Notes at various points will refer you to a more detailed treatment of individual topics.

There is a lot of good introductory material on Linux around. These are guides tailored to the Linux setup at MACS:. by Rob Stewart (a Linux practical for those completely new to Linux). These are general Linux tutorials or cheat sheets (a concise collection of the most important commands):. of the Advanced Bash Scripting Guide. The following resources are more detailed Linux introductions and tutorials:. A detailed 3-part course on Linux and Shell Scripting, by Information Services at Edinburgh University (copyright The University of Edinburgh 2012):.

(a software carpentry course). by Vivek G. Gite (an introduction starting from very basics; see also the ). by Mendel Cooper (the best source of information for bash scripting; example driven).

(for looking up details of bash commands etc). (especially useful for sysadmin tasks) Books about Linux and UNIX in general:.

by Mark G. Sobell, Prentice Hall, 2012. (an excellent, comprehensive guide to Linux usage, starting from scratch and reaching advanced usage)., By Grace Todino-Gonguet, John Strang, Jerry Peek. 5th Edition October 2001 ISBN 0-596-00261-0. (an introduction to UNIX for newbies)., By Arnold Robbin (standard reference book)., learning UNIX by examples (for Beginners). (the ultimate guide for efficient usage of UNIX tools).

GUIs are great—we wouldn’t want to live without them. But if you’re a Mac or Linux user and you want to get the most out of your operating system (and your keystrokes), you owe it to yourself to get acquainted with the Unix command line. Point-and-click is wonderful whenever you need to do something once or twice. But if you need to repeat that task many times, the command line is your savior. The command line is a window into the full, awesome power of your computer.

If you long to break free of the constraints of the GUI or think that programming or administering remote machines is in your future, then learning the Unix command line is definitely for you. Take control of your Mac with. Cut to the key news in technology trends and IT breakthroughs with the, our summary of the top tech happenings. Don't worry if Unix commands seem like magical incantations or the mysterious internals of the system seem beyond your grasp. They aren't that difficult to learn, and this article will give you the 10 essential commands you need to get started. Before long those cryptic strings will be second nature.

Shell basics The Unix command line shell is roughly equivalent to the command window in Microsoft Windows (cmd or PowerShell). The commands we walk through below will work on any Unix-like system, including Linux, Darwin (the foundation of MacOS), FreeBSD, and even Windows with something like or the new. The options and output vary slightly, but you should have no trouble making sense of them.

With this remarkable, now you have the ability to do all the tasks and work your boss ask. Powered by Peatix: More than a ticket. Jun 9, 2018 - QDS BRCM1051 DRIVERS FOR MAC - FCC requires this product to be used indoors for frequency range 5. These letters are chosen by the. Qds brcm1051 drivers for mac download. Da Semidice Viprima Drivers — 25 giugno 2018 alle 22:30. Class II Permissive Change to install the module into a. Jan 8, 2018 - QDS- BRCM1051 DRIVER FOR WINDOWS DOWNLOAD - SAR test seup. Systems: Windows NT/2000/XP/2003/2003/7/8/10 MacOS 10/X. Qds brcm1051 drivers for mac os. Oct 11, 2018 - QDS-BRCM1051 DRIVER - Aug 24, 17 May 6, 10, 10, Nov 30, 17. Operating Systems: Windows NT/2000/XP/2003/2003/7/8/10 MacOS 10/X.

First, you must open a shell, sometimes called a terminal window. Often Unix distributions put this under the Administration or System menus.

In MacOS, you’ll find the terminal in Applications Utilities Terminal. When you launch it, you'll see something like this: IDG This screen, from MacOS 10.11, is typical of most shells in a GUI. At the top of the window we see the type of shell, in this case Bash (Bourne Again Shell, which is the default shell in MacOS and most Linux distributions), and the size of the window.

Inside the window is the prompt, in this case configured to display the name of the machine ( Mercury), the name of the current working directory (here the tilde, , which is shorthand for the user’s home directory), the name of the user, and finally the prompt symbol (the $). Note that your prompt will change as you move around the file system or if you become a different user on your machine (such as the root or superuser in order to run administrative commands). The prompt displays this information, so you can easily tell where and who you are on any machine. It’s worth knowing there are two major flavors of the Unix shell: Bourne and C shell. Bourne and company were derived from the original AT&T Unix, while the C shell hails from the University of California at Berkeley and BSD Unix. Generally the Bourne and C shell derivatives are good for interactive work at the terminal. The POSIX standard shell, the Korn shell, is the one you'd want to use for writing your own programs in the shell, called scripts.

We use the Bash shell for the examples in this tutorial. The shell environment One of the first facts to understand about working on the Unix command line is that the shell operates in its own environment. Understanding how to control the shell environment is an important part of becoming efficient at the command line.

Let’s take a look at the environment using the env command: IDG Don't worry about understanding all of the environment variables now, but know that they're there. You should recognize a few variables already. For example, SHELL=/bin/bash tells us we're using the Bash shell. HOME=/Users/nunez specifies the location of the user’s home directory. You can change or create environment variables, and you will often do so. Here is an example of setting an environment variable called FOO and displaying its value: IDG As you see, by convention we put variables in upper case.

Take special note how we reference environment variables when we use them in commands, with the preceding $. The $ tells the command interpreter to use the variable’s value. Without the $, the echo command above would simply print the name of the variable, FOO. Unix commands Regardless of which shell you use, whenever you type a command in the shell, you will cause a Unix program to execute. The Unix design philosophy is to create programs that do one thing well and to chain (or “pipe”) them together to do useful work.

Let’s look at a simple example to count the number of files in the /etc directory (we’ll see how to move to the /etc directory later on): IDG This command sequence illustrates two important concepts: piping and options. The ls command (equivalent to the dir command in Windows) displays the contents of a directory, and wc (word count) the number of words. Notice the vertical bar between them? That's the pipe character. The pipe takes the output of the first command and directs it as input to the second command. You can chain any number of commands together in Unix by connecting one to another with pipes.

The second thing to notice is the options given to each command. In Unix, options are traditionally prefixed with a single dash character,.

These command-line options change the behavior of the command. In this example, the -l option to ls means to output the directory contents in “long” format, while the –l option to wc means to count the “lines” instead of the words. In English this command might be read: List the number of lines in the current directory and then send them to the word count program to count the number of lines. Often these command-line options override defaults that are set in the environment. If you want to change the way the command behaves on a permanent basis, you can set the environment variable automatically when you log in. Many commands allow you to combine options in a single string—for example, ls -la—but others do not.

You can learn about all of the options for a command by checking its manual or “man pages” (which we discuss below). Learning and using command-line options is a big part of being efficient at the Unix command line. Some commands have so many options that the documentation runs to dozens of pages. Don't let that worry you now. You often need only a few options to perform a given task, and many options are used only when writing programs in the shell language.

The manual Once you understand the basics of the command line and the environment, we can begin to dive deeper into the system. The first place to start is with the manual. One of the nice aspects of Unix is the high quality of the documentation. There is documentation for users, system administrators, and software developers. You access the documentation with the man command.

Let’s start by reading the manual for the manual (enter man man on the command line): IDG The manuals are divided into eight sections, which vary slightly depending on whether you're on a BSD/Linux/Mac or System V type of Unix. It's helpful to start by reading the introduction to each section, and you can do this with an incantation like man -s 1 intro, which means to look in section 1 to find a manual page called “intro”: IDG If you aren't sure of what command you're looking for, you can try the -f and -k options. Man –f command will tell you a command’s function if you know its name, while man –k hint will list the names of relevant commands based on one or more keywords. Both options will search a built-in database (if it has been configured; it usually has) and return all matches. For example, man –k bzer will display the manual pages that start with the string bz: IDG The file system There are many commands related to the Unix file system, since it is core to the operating system. We saw one of them earlier: ls, which lists files in a directory: IDG The ls command may be the most frequently used command of all, and it has many options to adjust its output. One option you will want to know about right away is ls -a (list all).

This will reveal “dot” files (files or directories whose names begin with a dot or period), which are hidden by default. These files or directories typically contain configuration information or log files for the Unix system. The.bashhistory file, for example, logs all the commands you enter on the command line. IDG The other command you will need right away is the cd command, which you use to change directories. This is akin to the same command in Windows, but with an important difference.

In Unix, all drives (devices) appear as a single drive. Whereas in Windows you might have your pictures on an external hard drive that appears as E:, in Unix that drive might be /home/user/pictures. All files on a Unix system are accessed via a path that starts with / (the root directory), and you can mount different hard drives at different points in the file system according to your needs.

Symbol a practical guide to unix for mac os x usersSymbol

Before you start wandering around the file system, let me introduce another command you’re going to need: pwd (print working directory). Because there are potentially many places to get lost in a growing file system, this commands lets you quickly determine where you are. Let’s switch directories to the location where system configuration files are kept and verify our location: IDG Note that you can use the cd command with no arguments to quickly return to your home directory. Another tip: The can be used as a shortcut to refer to your home directory in both Bash and C shell.

At this point you know how to move around the file system and list the contents of directories. Now we need a way to read the files stored in them. These days most systems come with the less command for this.

Less will display a file page by page and allow you to navigate using Vi commands (press j to move down, k to move up, h to get help, and q to exit the file). Let’s see what is in our /etc/passwd file by entering less /etc/passwd: IDG The passwd file lists the user accounts on a Unix system, along with their user and group ID numbers, their home directory, and the path to the corresponding command or shell. On MacOS, however, you’ll find only system service accounts in passwd. That’s because human users are configured under Users & Groups in MacOS’s System Preferences. Disk space Running out of disk space is a gradual process that might take years, but can still catch you off guard. There are two commands you can use to check your free space and determine which files are hogging your disk: du (disk usage) and df (disk free).

They both take a -h option (human readable). To get a sense of how full your disk is, use the df command: IDG For now, focus on the%iused and mounted on columns. This shows that my home directory is 92 percent full, so I should probably clean it up. But how do I know where all the space is being used? That’s what du is for: IDG For this example, I went with an incantation that limits the output to the first 10 lines. Otherwise du will list every directory on the machine, which could easily be too much to grasp. From this listing you can see how much space is consumed by each directory.

You might also see how, by chaining a few commands together, we could easily put together a script that would list the top 10 directories by space usage. The command we need to sort the output is of course the sort command. Because MacOS’s version of sort can’t handle du’s human readable output, I used the -m option for du to display disk usage in megabytes (use the -g or -k option to display in gigabytes or kilobytes).

The -n and -r options for sort sort the output numerically and in reverse order, so the largest directories will appear at the top of the list. Superusers, su, and sudo A number of commands relate to system administration. Try typing man -s 8 intro for an introduction to them. I’m going to give you the one essential command for system administration here: su. This stands for “super user” and refers to the administrative user or root account.

All files belonging to the system are owned by this user, and you'll need to become this user to perform administration. A related command, sudo, allows you to become the super user for a single command. Why use sudo instead of su? Because best practice dictates that you not run around as the root user, with the power to do irreparable harm by accident.

You'll always want to do everything you possibly can as a normal user and become a super user only when you need to. Exactly how you gain super user privileges will depend on your Unix distribution. Let’s see how su works on MacOS: IDG Huh? I'm sure I typed the password correctly. What has happened here is that my current user, nunez, does not have permission to su.

Symbol A Practical Guide To Unix For Mac Mac

Practical

On some Unixes this means the user needs to be in the wheel group, and on other systems (including MacOS) the user needs to be in the sudoers file. Let’s finish up by adding nunez to sudoers, which will give you a taste of editing files on the command line. Power users sing the praises of the Emacs and Vi editors, and I encourage you to try them, but we’ll use Nano here. Nano is easy to learn and use, and MacOS and many Linux distros come with it already installed.