![]() ![]() So a lot of time I’ll find something in Finder, open Terminal, type "nano " (with a space), then drag the item into terminal. Drag an item into the Terminal to get it’s path. Use sudo -s or sudo zsh to get a root shell.Īnother few tips with Terminal involve moving between Finder and Terminal. It shows similar commands.Ī blank sudo command logs you in as superuser Most of it won’t make sense until you get more familiar with Unix, but it’s always helpful. It’ll tell you in excruciating detail all about the command. MacOS and zsh are harder to find.Īlso note the man command. Linux books and BASH books are quite common. You just have to be aware there are some differences. If you get a Linux book on BASH, it’ll teach you quite a bit about MacOS and zsh programming. However, there are differences in configurations commands. Due to copyright issues with GNU, MacOS users zsh. ![]() Most Unix and Linux command lines use the BASH shell. If your new to the command line, do not use sudo unless you know exactly what you’re doing. Long time ago, I gave myself the ability to run sudo without the password and run sudo without another command. However, you can change this by editing the /etc/sudoers file. A blank sudo command logs you in as superuser - something you don’t usually want. I don’t remember the MacOS default, but I believe you need your password and you must enter a command you’re sudoing on the same line. Think of it as that permanent record you’re principal talked about in junior high school. The report is a log file on your computer. $ sudo passwd carol #set Carol’s passwordĪll sudo commands are normally logged (this is configurable) and if someone tries something they’re not supposed to do, you get that “Username is not in the sudoers file. Normally, the way you use sudo is to use sudo followed by the command you want to run. You are an administrator, you can use sudo. These are users who you specify as administrators in the System Preference. Instead, certain users are given sudo access. Bob can be given superuser status to run backups, but not to reformat the hard drive. This was set in a file called /etc/sudoers In this file you can specify which users and groups have superuser (or su) access for which commands, and if they need to enter their personal password to run these commands. This command gives people like Bob certain super user access for particular commands. You could give Bob the root password, but you don’t want him being able to do everything, just run the backup.Įnter the sudo command. He wouldn’t normally be given read access to other user’s files, and maybe also excluded from reading certain administrator files (like /etc/shadow that contains the passwords). Imagine if Bob was given the task to make backups. Sometimes, certain users need to do something they’re not normally allowed to do. (Well it spawns a shell making you superuser) The su command logs you in as the superuser. Basically, root can do anything on the system. User 0 is usually known as root or the superuser. In traditional Unix, each user has a digital user ID. Yes, you can destroy your computer with sudo. You just need to "su " before you use “sudo”. In Terminal (or iTerm2), you just need to “su adminusername” before you use “sudo”. If you see the “Username is not in the sudoers file" message it means you are a non-admin user, which is usually good. If you can learn this you will be surprised how much you can do. Learn how to transfer files back and forth between servers with scp. Learn how relative vs absolute paths work ("/" vs everything else). ![]() If you are going to do system admin type stuff you’ll need to learn how to use vi a little (how to enter edit mode, exit edit mode, quit without saving, and saving and quitting). But you can also over write files with mv and cp. Obviously rm is where you can do the most damage. Learn how to navigate the file system (cd), look for files (ls, find), view them (cat), edit them (nano or download the micro text editor), move them (mv), copy them (cp), delete them (rm), change permissions (chmod and chown), and check to see where you are (pwd or cwd). I would find things you normally do with the Finder and slowly learn how to do them with the Terminal. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |