Terminal&Shell: Learning Linux/Unix terminal commands ver. 12

Last Updated on September 10, 2022 by shibatau

The red parts are added.

I. Let’s learn terminal commands

We will learn Linux/Macのterminal commands.

Basic Linux/Unix Commands with Examples and Syntax

17 Terminal Commands Every Programmer Should Know

How To Use Pbcopy And Pbpaste Commands On Linux

II. My environments

1.iMac: Kitty + Fish + Oh My Posh

2.Linux (Pop!_OS): Kitty + Fish + Oh My Zsh

Kitty is the fast, feature-rich, GPU based terminal emulator, which is available for macOS and Linux.

Fish Shell is a smart and user-friendly command line shell.

Oh My Posh enables you to use the full color set of your terminal by using colors to define and render the prompt.

III. Cmmands

Print working directory
pwd

Moving to home directory
cd

Moving to root directory (Fish)
cd /

Moving to Desktop from home (Fish)
cdDesktop/

Moving up one directory level (Fish)
cd..

Listing all files and directories in the directory
ls

Listing hidden files as well
ls -a

Show the permissions, size, and date last modified among other meta-data (referred to as long listing format)
ls -l

Creating a Directory
mkdir NAME

Creating nested directories
mkdir -p NAME1/NAME2/NAME3

Creating files
touch filename.txt

Creating files with texts

  1.  cat > filename.txt
  2. This is a sample.
  3. hit enter to move to the next line
  4. hit enter to move to the next line and then press CTRL + d to return to command prompt

Displaying the file content
cat NAME.txt

Combining tow files
cat file1 file2 > newfilename

Open a file in its default application
xdg-open NAME.pdf

open NAME.pdf (Fish)

Removing a file
rm NAME

trash-put NAME (trash-cli)

Removing directories
rmdir DIRECTORYNAME

trash-put DIRECTORYNAME (trash-cli)

Delete a directory and its subdirectories
rm -r DIRECTORYNAME

rash-put DIRECTORYNAME (trash-cli)

Copy files
cp NAME.txt NAME_COPY.txt

Copy directories
cp -r DIRECTORYNAME DIRECTORYNAME_COPY

Moving files
mv NAME.txt ~/Dropbox

Renaming files
mv NAME.txt NAME_NEW.txt

Copy to the clipboard (installed with sudo apt install xclip)
xclip

Paste from the clipboard (installed with sudo apt install xsel)
xsel

About shibatau

I was born and grown up in Kyoto. I studied western philosophy at the University and specialized in analytic philosophy, especially Ludwig Wittgenstein at the postgraduate school. I'm interested in new technology, especially machine learning and have been learning R language for two years and began to learn Python last summer. Listening toParamore, Sia, Amazarashi and MIyuki Nakajima. Favorite movies I've recently seen: "FREEHELD". Favorite actors and actresses: Anthony Hopkins, Denzel Washington, Ellen Page, Meryl Streep, Mia Wasikowska and Robert DeNiro. Favorite books: Fyodor Mikhailovich Dostoyevsky, "The Karamazov Brothers", Shinran, "Lamentations of Divergences". Favorite phrase: Salvation by Faith. Twitter: @shibatau

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.