Home >System Tutorial >MAC >How to save files on mac terminal?

How to save files on mac terminal?

PHPz
PHPzforward
2024-01-12 11:36:091489browse

Foreword: Many friends have asked related questions about how to save files on the Mac terminal. This text site will give you a detailed answer for your reference. I hope it will be helpful to you! Let’s take a look!

Mac terminal solves the problem that many system built-in commands cannot be found

1. When using the terminal, Mac creates files through the command touch command, prompting: -bash: touch: command not found. After searching online for a long time, they all said that touch is needed to create a file. Oh my God, touch cannot be executed. How can I create a file?

2. Solution: Use temporary environment variables (invalid after restart) export PATH=$PATH:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin :/usr/bin This will allow you to use most commands temporarily.

3. Let me talk about my solution: Enter in the command line: This can ensure that the command line command can be used temporarily. Do not close the terminal after executing the command. Enter to enter the current user's home directory.

4. Open terminal 2 and enter cd ~/ to enter the current user’s home directory.

5. Run the command pip install pyreadline. Be sure to install this first and then install ipython, otherwise ipython will not execute. Install ipython.

6. Start the Terminal that comes with Mac. Enter the current user's home directory. Enter echo $HOME on the command line to create the .bash_profile file. Enter touch .bash_profile on the command line to open the .bash_profile file.

What to do if Mac terminal cds to a folder on the desktop

Click to open the command prompt on the taskbar. Open the command prompt, as shown in the figure, you can see that the current location of the command prompt is: C:\Windows\System32. If you remember the path to the new folder on your desktop, you can skip this step. If you don’t remember the path, first check the location of the new folder on your desktop.

Use cp -r in the mac terminal to copy a folder in the disk image to the desktop: Pay attention to the file path: Sometimes the relative path is used as an absolute path: for example, the current folder is named tset. It should be cp ./test /home/username/Desktop.

Right-click on the lower left corner of the computer and select the Run button to enter. Enter CMD in the dialog box that appears and click the OK button. In the command prompt interface that appears, enter such as F: and click the Enter button. It should be noted that the English input method is used in this interface.

The method is as follows: Go to ‘System Preferences’-Keyboard-Shortcuts-‘Services’ and check Create a new terminal label located in the folder location, and create a new terminal window located in the folder location.

If there are no folders on the desktop, you can directly right-click on the blank space and select New Folder. You will see an unnamed folder icon appear. To add a folder within an application to the desktop, click on the Finder. Click Apps on the left.

Open the Mac terminal, drag the file into the command line, and the file address will appear automatically.

How to save files on mac terminal?

Mac Terminal Modify Document Folder Location

1. Documents are usually saved in the "Documents" folder on Mac. This folder Located in the user's home directory. You can access this folder from the left sidebar in the Finder, or use Spotlight Search to search to find documents.

2. Method: Click the [finder] function in the lower left corner of the mac computer desktop; after opening finder, press the keyboard shortcut [shift cmd G] and enter [/private] to open a new page.

3. Step 1: Open "Screenshot"; Step 2: Click "Options" below; Step 3: Select "Other Locations" to change the storage location of MacBook screenshots. Note: Mac screenshots - change the default path so that you can save Mac screenshots to the specified folder.

4. Click the "Service" menu item to pop up the submenu. Click "Service Preferences" in the submenu. Click "Service" in the pop-up service preference window and check "New terminal window located in folder location"; click this item to set a shortcut key for this operation.

5. The default save location of most applications is usually the "User" folder in the "Documents" or "Downloads" folder.

6. Open the terminal on the mac, enter the file directory, and modify the permissions.

MAC terminal command-file operation, editing operation

1. The OS X system terminal command is as follows: enter: sudo /Applications/TextEdit.app/Contents/MacOS/TextEdit /etc/hosts You can use text editing to modify hosts directly. There are many ways to set whether hidden files are displayed, the simplest is to enter commands in the Mac terminal.

2. Obtain administrator rights: Enter sudo -s and then enter the password. You will not be prompted. Just press Enter after entering, and then you will obtain administrator rights.

3. Although users who want to use large blank files may prefer the terminal command line, the Disk Utility application can also complete this operation well. After opening Disk Utility, click the "File" drop-down menu in the upper left corner, select New, and then select "Blank Disk Image."

4. chflags nohidden ~/Library/ Hide in the "Terminal" and enter the following command: chflags hidden ~/Library/ Method 2: Open Finder, select Go in the menu and hold down the option key to display the resource library items (each You need to repeat the operation every time you open it).

5. dd if=/dev/zero of=LargeTestFile.img bs=1024 count=0 seek=$[1024*100] Use disk utility to create a large blank file although you want to use a large blank file users may prefer the Terminal command line, but the Disk Utility application can also perform this operation well.

Conclusion: The above is all the content on how to save files on Mac terminal introduced by this site. I hope it will be helpful to everyone. If you want to know more about this, remember to bookmark and follow this article. stand.

The above is the detailed content of How to save files on mac terminal?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:shouxicto.com. If there is any infringement, please contact admin@php.cn delete