MacOS Terminal



||| Default shell version in macOS Big Sur (Version 11.6.3) |||
---------------------------------------------------------------

% python --version
Python 2.7.16

% bash --version
GNU bash, version 3.2.57(1)-release (arm64-apple-darwin20)
Copyright (C) 2007 Free Software Foundation, Inc.

% zsh --version
zsh 5.8 (x86_64-apple-darwin20.0)

||| Default shell version in macOS Monterey (Version 12.1) |||
--------------------------------------------------------------

% python --version
Python 2.7.18

% bash --version
GNU bash, version 3.2.57(1)-release (arm64-apple-darwin21)
Copyright (C) 2007 Free Software Foundation, Inc.

% zsh --version
zsh 5.8 (x86_64-apple-darwin21.0)

||| FILE |||
------------

Example 1: Create a file
% touch filename.sh

Example 2: Make it executable
% chmod +x filename.sh

Example 3: Open the file and press "i" to add the contents, before exit, save the file, press "esc" than ":wq"
% vi filename.sh

add below contents
#! /bin/bash
echo "Hello Friends"

Example 4: run script
% ./filename.sh

Example 5: delete the file
% rm filename.sh

Example 6:
Force removal without confirmation
% rm -f filename.sh

|| FOLDER ||
------------

Example 1: Create a folder
% mkdir foldername

Create a folder with a space
% mkdir "folder name"

Example 2: Rename the folder
%

Example 3: Delete the folder (only works on empty folder)
% rmdir foldername

Delete a folder and its contents
% rm -R foldername

mv Move/rename

cp Copy a file to the current folder

Post a Comment

0 Comments