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.
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.
Print working directory
Moving to home directory
Moving to root directory (Fish)
Moving to Desktop from home (Fish)
Moving up one directory level (Fish)
Listing all files and directories in the directory
Listing hidden files as well
Show the permissions, size, and date last modified among other meta-data (referred to as long listing format)
Creating a Directory
Creating nested directories
mkdir -p NAME1/NAME2/NAME3
Creating files with texts
- cat > filename.txt
- This is a sample.
- hit enter to move to the next line
- hit enter to move to the next line and then press CTRL + d to return to command prompt
Displaying the file content
Combining tow files
cat file1 file2 > newfilename
Open a file in its default application
open NAME.pdf (Fish)
Removing a file
trash-put NAME (trash-cli)
trash-put DIRECTORYNAME (trash-cli)
Delete a directory and its subdirectories
rm -r DIRECTORYNAME
rash-put DIRECTORYNAME (trash-cli)
cp NAME.txt NAME_COPY.txt
cp -r DIRECTORYNAME DIRECTORYNAME_COPY
mv NAME.txt ~/Dropbox
mv NAME.txt NAME_NEW.txt
Copy to the clipboard (installed with sudo apt install xclip)
Paste from the clipboard (installed with sudo apt install xsel)