Skip to content

Instantly share code, notes, and snippets.

@SofijaErkin
Last active May 17, 2023 13:07
Show Gist options
  • Save SofijaErkin/bea65b4c8d367c90bfd2d88aa8c3be43 to your computer and use it in GitHub Desktop.
Save SofijaErkin/bea65b4c8d367c90bfd2d88aa8c3be43 to your computer and use it in GitHub Desktop.
Some terminal command to recommend.

Shell Command Manual ABC

BackUp: GitHub Project, GitHub Gist.

1. Check Default Shell

echo $SHELL

2. Linux Download Tools

Debian(Ubuntu): apt, apt-get;

Fedora: dnf;

CentOS: yum;

3. Check Java Version

java -version

4. Check dependence

macOS:

brew deps xxx -tree

5. Grep

To find out "python":

ls -l | grep "python"

6. Check Upgrade and Upgrade

To check whether has been upgrade on Debian:

sudo apt update

sudo apt-get update

Debian To upgrade all the latest version:

sudo apt update && sudo apt upgrade

refer: How do I check for updates on Debian 11?

7. Search

To search package on macOS/Debian:

macOS:

brew search package

Debian:

apt search package

apt-cache madison package

8. Exit Ping

macOS/Linux: Ctrl + c.

9.Check VM Disk usage

Just login your VM on Host terminal and then check, e.g: Debian.

df -h

df -T

df -i

df -k

free -l

sudo fdisk -l

sudo cfdisk

Copy current line: esc + yy;

Paste to the cursor: p;

Enclose the whole path by double-quotes ", single-quote ' or escape the

space character using a backslash \.

Reboot/restart Ubuntu(Debian) : sudo reboot;

Shut down Debian:

sudo poweroff

sudo shutdown -h now

sudo systemctl poweroff

13.Check the version of Glibc on Debian or Ubuntu

ldd --version

Or, e.g: x86_64-Debian/x_64-Debian:

/lib/x86_64-linux-gnu/libc.so.6

i386-Debian:

/lib/i386-linux-gnu/libc.so.6

14.Rename the file or directory

14.1Command mv

Rename only one:

mv source_file_or_directory destination

If destination_file does not exist, source_file_or_directory is renamed

destination_file.

14.2Command rename

Rename multiple files, using regular expressions.

14.3Reference

1.How to change or rename a file, folder, or directory.

2.Linux mv command.

3.Linux rename command.

15.Compile and Execute Java Program

(From the Command Prompt, type to compile)
javac HelloWorld.java
(At the Command Prompt, type to Execute)
java HelloWorld
(Try running your program with the command line while Troubleshooting)
java -classpath ./ HelloWorld

Reference: Hello, World in Java on Mac OS X.

16.Check Where does JDK installed

java -verbose
/usr/libexec/java_home -V

17.Decompress files

(.tar.gz) tar -xzvf decompress_file_with_tar_gz
(.zip)  unzip -d /decompress/into/this/directory file_with_zip

18.Create Soft Link

(sudo) ln -sv /source/directory/file /direction/file/soft/link

VIM Command Manual ABC

1. Take active or Reload VIM configuration vimrc

(VIM status command)
:source ~/.vimrc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment