code • Terminal command lines (CLI) - martindubenet/wed-dev-design GitHub Wiki

[  Git apps  ][  Git via Terminal (CLI)  ][  Terminal command lines (CLI)  ][  Setup Terminal shell  ]

Terminal command lines

Command Description CLI example
pwd The full path to your home directory
ls -la List all files from the repository (including hidden files) sorted by name
ls -d */ List all (sub)directories within the current path
&& « AND » : Combine two command on one line. pwd && ls -la
touch Creating a new file. This command has its own subset of commands to edit a file touch NewFile.txt
mkdir « Make Directory » : Creating a new folder. mkdir NewFolder
mv « Move » one or multiple files or folders. Allowing to rename at the same time. mv ~/Desktop/NewFile.txt /Volumes/USB Drive/AnyFolder
~/ Root of the active user cd ~/Sites/
cd « Change Directory » : Moving to a different driver or folder. Win: cd /c/
Mac: cd /Volumes/Macintosh HD/
echo "String" >> file.txt Adds the « String » as content within the file echo "# Hello World >> example.md
⌃Ctrl+L Clear the terminal viewport.
⌃Ctrl+Z Stops the running command.
⌃Ctrl+X Stops the running command.
⌃Ctrl+C () Stops the running .sh command.

Change directory to another disk

OS Description CLI example
macOS On Linux OS the term « Volumes » refers to « Drives » for Windows, as a disk on the computer. cd /Volumes/usbT7r/Projects/www/
Ubuntu Linux Same as on macOS cd ~/Projects/
Windows Windows requires to do it in two steps; First declare on what Drive, then where on that Drive. cd c: && cd /c/wamp64/www/

Shell command lines

Command Description
echo $SHELL Know what shell is active
chsh -s /bin/bash Switch to Bash terminal shell
chsh -s /bin/zsh Switch to Zsh terminal shell
which zsh Validate that you have Zsh intalled

 

Useful sequence of commands

(1) Make a new folder, (2) move to that new folder, (3) create a new file in it.

mkdir NewFolder && cd NewFolder && touch NewFile.txt

Move to WAMP document root repository on Windows PC

cd c: && cd /c/wamp64/www/

Unix mail

When launching a Terminal window (on  macOS) you may have a line that says « You have mail ». This is NOT your usual E-mail, this is your Unix server mail system. These mail messages are probably about tested email form submits that did not got delivered.

mail is one of many cron sequencer. Cron is a time-based job scheduler. A scheduled job is known as a cron job.

  1. Launch the mail app from CLI

    mail

  2. View the entire inbox of mail

    cat /var/mail/$USER

  3. To delete all mail messages

    : > /var/mail/$USER
    Or

    d *
    q
    

 

 

⚠️ **GitHub.com Fallback** ⚠️