Just a list of useful commands

I gathered some terminal commands and put them into a .toml file (for easier viewing) and just thought I’d post them here in case they were useful for anyone else. I got chat to work so any mistakes, he’s to blame. :smiley:


the stat command provides detailed information about a file = "stat /path/to/file_or_directory"
"use locate/find to search for .pac files = "sudo find /etc -name "*.pacsave" -o -name "*.pacnew" or "sudo updatedb" and "locate '*.pacnew *.pacsave'"
get more detailed information about past transactions including any errors that may have occurred during installation or updates = "less /var/log/pacman.log"
identify missing or broken dependencies = "sudo pacman -Dk"
If pacman -Dk indicates missing dependencies you can attempt to resolve them by reinstalling the affected packages along with their dependencies = "sudo pacman -S --needed package_name"
see the dependency tree for a package = "pactree -c package_name"
"packages can conflict with each other which can manifest as a dependency problem = "sudo pacman -Si package_name | grep "Conflicts With"
downgrade = "downgrade [package-name]"
list_files = "pacman -Ql [package-name]"
find_owner = "pacman -Qo [file-path]"
remove_orphans = "sudo pacman -Rs $(pacman -Qdtq)"
backup_installed_packages = "pacman -Qqe > pacman_packages_backup.txt"
lock_package = "sudo echo '[package-name]' >> /etc/pacman.conf"
unlock_package = "sudo sed -i '/[package-name]/d' /etc/pacman.conf"
ignore_package_upgrade = "echo 'IgnorePkg = [package-name]' | sudo tee -a /etc/pacman.conf"
query = "pacman -Q"
list_orphans = "pacman -Qdt"
list_explicitly_installed = "pacman -Qe"
list_foreign = "pacman -Qm"
search_by_name_or_description = "pacman -Qs [search-term]"
check_broken_dependencies = "pacman -Qk"
list_packages_by_size = "pacman -Qi | awk '/^Name/{name=$3} /^Installed Size/{print $4$5, name}' | sort -hr"
installed_packages_to_file = "pacman -Q > ~/installed_packages.txt"
list_unused_repositories = "pacman -Qdtq | pacman -Qo -"
yay_print_foreign_packages = "yay -Pw"
pull_git_repo = "git pull"
install_package = "pacman -S package_name"
install_package_without_confirming = "pacman -S --noconfirm package_name"
install_package_ignore_package_group = "pacman -S --needed package_name"
install_specific_package_version = "pacman -S package=version"
download_package_files_only = "pacman -Sw package_name"
install_all_packages_from_group = "pacman -S group_name"
list_outdated_packages = "pacman -Qu"
install_or_upgrade_package_from_local_file = "sudo pacman -U /path/to/package-file.pkg.tar.xz"
list_inconsistent_packages = "pacman -Qii"
remove_package_and_dependencies_not_required = "sudo pacman -Rns [package-name]"
remove_package_and_dependencies_dangerously = "sudo pacman -Rdd [package-name]"
install_package_with_explicit_confirmation = "pacman -S --ask=4 package_name"
install_package_skip_integrity_check = "pacman -S --skipinteg package_name"
install_package_from_a_specific_repo = "pacman -S repo_name/package_name"
install_package_ignore_scriptlets = "pacman -S --noscriptlet package_name"
install_packages_overwriting_files = "pacman -S --overwrite glob_pattern package_name"
install_package_ignore_architecture = "pacman -S --ignorearch package_name"
install_package_with_disabled_dependency_checks = "pacman -S --nodeps package_name"
refresh_package_databases = "pacman -Sy"
update_system = "pacman -Syu"
update_system_without_downloading_any_packages = "pacman -Syuw"
install_or_upgrade_package = "pacman -Syy package_name"
install = "pacman -S"  
update_system = "pacman -Syu" 
download_only = "pacman -Sw" 
clear_cache = "pacman -Sc"  
info = "pacman -Si [package-name]"
To install a package locally meaning a package download from the net. = "sudo pacman -U /home/yourusername/Downloads/zoom_x86_64.pkg.tar.xz"
If you want to see the dependency tree of a specific package then run this command can be run. "sudo pactree vlc"


remove_package = "pacman -R package_name"
To remove a package and its dependencies which are not required by any other installed package = "pacman -Rs package_name"
when removing a group which contains otherwise needed packages. In this case use = "pacman -Rsu package_name"
"To remove a package, its dependencies and all the packages that depend on the target package, (RECURSIVE) = "pacman -Rsc package_name"
remove_package_ignore_dependencies = "pacman -Rdd package_name"
remove_package_skip_dependency_version_checks = "pacman -Rn package_name"
remove_package_and_dependencies_without_dependency_check = "pacman -Rns package_name"
remove_package_verify_files = "pacman -Rk package_name"
Followed by a pacman -D cmd when install reinstalling for reverse dependencies = "sudo pacman -S libnotify"
"Marks the 'said' package as a dependency. = "sudo pacman -D --asdeps libnotify"
"Marks the 'said' package as a explicitly installed. = "sudo pacman -D --asexplicit packagename"


change_shell_to_zsh = "chsh -s $(which zsh)"
add_user_with_groups = "useradd -m -G wheel,input,video -s /bin/bash tom"
modify_user = "usermod"
delete_user = "userdel"
list_users = "cat /etc/passwd"
list_groups = "groups"
list_logged_in_users = "who"
show_current_user = "whoami"
show_user_details = "id <username>"
show_group_details = "id <groupname>"


list_pci_devices = "lspci"
list_cpu_info = "lscpu"
count_processors = "nproc"
systemctl_usage = "systemctl"
ip_link_show = "ip link"
ip_address_show = "ip address"
list_block_devices = "lsblk"
manage_disk_partitions_with_fdisk = "fdisk"
manage_disk_partitions_with_gdisk = "gdisk"
open_gparted = "gparted"
run_script = "./sh"
ssh_command = "ssh"
switch_user = "su"
curl_arch_news = "curl -s https://archlinux.org/feeds/news/"
install_newsboat = "sudo pacman -S newsboat"
open_alacritty_manual = "man 5 alacritty"


print_working_directory = "pwd"
edit_systemctl_service = "systemctl edit"
create_empty_file = "touch"
mount_command = "Mount"
edit_with_nano = "nano -w"
disk_free_human_readable = "df -h"
"dd if=/dev/sda of=backup.img bs=1M status=progress = "Try diffenent block sizes"
change_file_mode = "chmod"
change_file_owner = "chown"
print_text = "echo"
search_with_grep = "grep"
pipe = "|"
list_directory_contents = "ls"
remove_file = "rm -f" 
copy_file = "cp -r" 
move_file = "mv -i" 
make_directory = "mkdir -p" 
remove_directory = "rmdir --ignore-fail-on-non-empty"
show_file_contents = "cat"
monitor_file_changes = "tail -f"
compare_files = "diff"
count_words = "wc"
find_files = "find"
view_file_less = "less"
view_file_more = "more"
archive_files = "tar"
compress_file = "gzip"
decompress_file = "gunzip"
When you want to keep the unzip file and the original compressed file use the -k flag. = "gunzip -k geeksforgeeks.txt.tar.gz"
The -l option is used to get the information of a compressed or an uncompressed file.gunzip -l = "geeksforgeeks.txt.tar.gz"
to test whether a file is valid or not use the -t option = "gunzip -t [File name]"
show_disk_usage = "du"
redirect_output = ">"
append_output = ">>"
execute_curl = "curl"
execute_git = "git"
mount_all_filesystems = "sudo mount -a"
list_blkid = "sudo blkid"
execute_xbind_key = "xbind-key"
execute_i3 = "exec i3"
edit_bashrc = "sudo vim /etc/skel/.bashrc"
list_etc_skel = "ls -la /etc/skel"
print_date = "date"
set_timezone_to_london = "loadkeys uk"
show_disk_space_for_home = "df -h /home"
set_editor_to_vim = "export EDITOR=vim"
print_editor_env_variable = "echo $EDITOR"
status_of_service = "systemctl status [some].service"
enable_network_manager_service = "systemctl enable NetworkManager.service"
network_manager_cli_device = "nmcli device"
toggle_wifi = "nmcli radio wifi on/off"


create_symlink_for_picom = "ln -s ~/.config/picom.conf /etc/xdg/picom.conf"
list_files_xdg =  "sudo ls -lF"
find_symbolic_links = "find . -type l -ls"
find_file_by_name_case_insensitive = "find / -type f -iname 'User-Dirs.Dirs'"
"see where the link points to = readlink /root/.config/nvim/init.vim


update_database = "sudo updatedb"
"To search for all files and directories that contain a specific keyword, you use
locate keyword basic_locate = "locate keyword"
limit_locate_results = "locate -n 10 keyword"
case_insensitive_locate = "locate -i keyword"
regular_expression_locate = "locate -r 'regex_pattern'"


watch_logs = "journalctl -f"
filter_logs_by_service = "journalctl -u lightdm"
logs_since_last_hour = "journalctl --since '1 hour ago'"
error_logs_since_five_minutes = "journalctl -p err --since '5 minutes ago'"
warning_logs_since_five_minutes = "journalctl -p warning --since '5 minutes ago'"
logs_from_current_boot = "journalctl -b"
error_logs_from_current_boot = "journalctl -b -p err"


display_kernel_messages = "dmesg"
filter_kernel_errors = "dmesg | grep -i error"
monitor_kernel_messages = "dmesg -wH | grep -i error"
show_kernel_version = "uname -r"
list_loaded_kernel_modules = "lsmod"
show_kernel_parameters = "sysctl -a"
show_cpu_interrupts = "cat /proc/interrupts"
show_kernel_memory_usage = "cat /proc/meminfo"
show_system_uptime = "uptime"
show_system_load_averages = "cat /proc/loadavg"


query_display_settings = "xrandr --query"
set_display_dpi = "xrandr --output <display-name> --dpi <dpi-value>"
set_screen_resolution = "xrandr --output <display-name> --mode <resolution>"
rotate_screen = "xrandr --output <display-name> --rotate <orientation>"
reset_screen_orientation = "xrandr --output <display-name> --rotate normal"
graphics_information = "glxinfo | grep -i opengl"


list_usb_devices = "lsusb"
show_usb_details = "lsusb -v"
show_usb_device_path = "lsusb -t"
display_usb_device_tree = "lsusb -t -v"


detailed_hardware_info = "inxi -Fxz"
show_cpu_info = "lscpu"
display_memory_info = "free -h"
show_block_devices = "lsblk"
show_disk_usage = "df -h"
show_network_info = "ip addr show"
show_sata_info = "sudo hdparm -I /dev/sdX"
show_system_info = "sudo dmidecode --type system"
show_bios_info = "sudo dmidecode --type bios"
show_processor_info = "sudo dmidecode --type processor"
show_number_of_cores = "nproc"
show_disk_space_info = "du -h"
check_connectivity = "ping -c 4 google.com"
display_interfaces = "ip a"
display_routes = "ip r"
trace_route = "traceroute google.com"
network_statistics = "netstat -s"
connection_monitor = "ss -tulpn"
network_debugging_tool = "nc -vz google.com 80"
dns_lookup = "dig google.com"
reverse_dns_lookup = "nslookup"
network_discovery = "nmap -v scanme.nmap.org"
arp_table = "arp -a"
manage_wireless = "iwconfig"
packet_capture = "tcpdump -c 10"
configure_firewall = "sudo iptables -L"
view_routing_table = "route -n"
display_link_interfaces = "ip link show"
set_interface_up = "sudo ip link set dev eth0 up"
set_interface_down = "sudo ip link set dev eth0 down"
set_mac_address = "sudo ip link set dev eth0 address 02:01:02:03:04:08"
set_interface_promiscuous = "sudo ip link set dev eth0 promisc on"
set_mtu = "sudo ip link set dev eth0 mtu 1420"
show_network_connections = "nmcli con show"
show_device_status = "nmcli dev status"
connect_wifi = "nmcli dev wifi connect SSID-Name password your-password"
list_available_wifi = "nmcli dev wifi"
modify_connection_autoconnect = "nmcli con mod connection-name autoconnect yes"
add_new_ethernet_connection = "nmcli con add type ethernet con-name MyEthernet ifname eth0"
turn_wifi_on = "nmcli radio wifi on"
turn_wifi_off = "nmcli radio wifi off"
browse_with_lynx = "lynx example.com"
browse_with_links = "links example.com"
browse_with_w3m = "w3m example.com"
browse_with_elinks = "elinks example.com"
search_with_lynx = "lynx 'http://google.com/search?q=search+term'"
search_with_links = "links 'http://google.com/search?q=search+term'"
search_with_w3m = "w3m 'http://google.com/search?q=search+term'"
search_with_elinks = "elinks 'http://google.com/search?q=search+term'"
quit_lynx = "echo 'q' | lynx"
quit_links = "echo 'q' | links"
quit_w3m = "echo 'q' | w3m"
quit_elinks = "echo 'q' | elinks"
download_file = "curl -O [URL]"
view_web_page = "curl [URL]"
send_post_request = "curl -d '[data]' -X POST [URL]"
send_get_request = "curl -G -d '[data]' [URL]"
set_user_agent = "curl -A 'User-Agent' [URL]"
save_cookie = "curl -c cookies.txt [URL]"
load_cookie = "curl -b cookies.txt [URL]"
follow_redirects = "curl -L [URL]"
view_headers = "curl -I [URL]"
download_with_limit_rate = "curl --limit-rate 100k -O [URL]"
upload_file_ftp = "curl -T [path_to_file] ftp://[username]:[password]@[URL]"
send_custom_header = "curl -H 'X-Custom-Header: Value' [URL]"


regenerate_initramfs = "mkinitcpio -P"
update_grub_cfg = "grub-mkconfig -o /boot/grub/grub.cfg"
install_grub = "grub-install --target=x86_64-efi --efi-directory=/efi --bootloader-id=GRUB"
add_module = "modprobe [module_name]"
remove_module = "modprobe -r [module_name]"
force_add_module = "modprobe -f [module_name]"
add_module_with_options = "modprobe [module_name] option1=value1 option2=value2"
check installed fonts = "fc-list"
update fontconfig cache = "fc-cache"
easily select a theme = "rofi-theme-selector"

save = ":w"
quit = ":q"
save_and_quit = ":wq"
force_quit = ":q!"
open_file = ":e filename"
refresh_file = ":e!"

undo = "u"
redo = "Ctrl+r"
copy = "y"
cut = "d"
paste = "p"
select_all = "ggVG"
repeat_last_command = "."
delete_line = "dd"
insert_mode = "i"
append_mode = "a"
replace_mode = "R"

move_cursor_up = "k"
move_cursor_down = "j"
move_cursor_left = "h"
move_cursor_right = "l"
go_to_start_of_file = "gg"
go_to_end_of_file = "G"
move_to_line_number = ":<line number>"
next_word = "w"
previous_word = "b"
start_of_line = "0"
end_of_line = "$"
first_non_blank_character_of_line = "^"
move_to_start_of_next_line = "+"
move_to_start_of_previous_line = "-"
go_to_matching_bracket = "%"
scroll_down = "Ctrl+d"
scroll_up = "Ctrl+u"
half_page_down = "Ctrl+d"
half_page_up = "Ctrl+u"
full_page_down = "Ctrl+f"
full_page_up = "Ctrl+b"

search_forward = "/pattern"
search_backward = "?pattern"
next_occurrence = "n"
previous_occurrence = "N"
replace_one = ":%s/old/new/gc"
highlight_search = ":set hlsearch"
no_highlight_search = ":nohlsearch"
toggle_highlight = "nnoremap <F3> :set hlsearch!<CR>"

split_window_horizontally = ":split"
split_window_vertically = ":vsplit"
move_to_next_window = "Ctrl+w w"
close_current_window = ":close"
resize_window = ":resize 10"

new_tab = ":tabnew"
next_tab = ":tabn"
previous_tab = ":tabp"
move_tab_to_position = ":tabm 0"
close_tab = ":tabclose"

show_line_numbers = ":set number"
hide_line_numbers = ":set nonumber"
syntax_on = ":syntax on"
syntax_off = ":syntax off"
set_indentation = ":set tabstop=4"
enable_auto_indent = ":set autoindent"
insert_blkid_in_vim = ":r!blkid"

browse_files = ":Explore"
find_file = ":find <filename>"
save_as = ":saveas <filename>"

start_recording_macro = "q<letter>"
end_recording_macro = "q"
play_macro = "@<letter>"

create_fold = "zf"
open_fold = "zo"
close_fold = "zc"
open_all_folds = "zR"
close_all_folds = "zM"

yank_line = "yy"
yank_to_end_of_line = "y$"
paste_after_cursor = "p"
paste_before_cursor = "P"
delete_character_under_cursor = "x"
delete_word = "dw"
delete_to_end_of_line = "D"
cut_line = "dd"

description = "In Vim, every open file is loaded into a buffer, which is a temporary storage area in memory. You interact with your files through these buffers."

description = "You can open new files in buffers without leaving Vim, using various commands."
commands = [
  ":e filename",  # Open a file in the current buffer
  ":sp filename",  # Open a file in a new horizontal split
  ":vsp filename",  # Open a file in a new vertical split
  ":tabe filename"  # Open a file in a new tab

description = "Vim allows you to switch between open buffers easily. Listing buffers and navigating through them can be done with simple commands."
commands = [
  ":ls",  # List all buffers
  ":bnext",  # Move to the next buffer
  ":bprev",  # Move to the previous buffer
  ":b<number>",  # Switch to a specific buffer by number
  ":bd",  # Delete a buffer, closing the file without exiting Vim

description = "Saving changes in Vim can be done per buffer or globally."
commands = [
  ":w",  # Save changes in the current buffer
  ":wa",  # Save all buffers
  ":wq"  # Save and exit the current buffer

description = "Efficiency in Vim can be significantly enhanced with custom key mappings, allowing you to navigate between buffers using keyboard shortcuts."
examples = [
  "Map Ctrl+n to switch to the next buffer",
  "nnoremap <C-n> :bnext<CR>",
  "Map Ctrl+p to switch to the previous buffer",
  "nnoremap <C-p> :bprev<CR>",

description = "To use the key mappings, ensure they are included in your vimrc file, which is Vim's configuration file. These mappings are set for normal mode, which is the default mode when you are not inserting text."

description = "The commands in this guide are case-sensitive and should be entered in normal mode. You can enter normal mode from insert mode by pressing 'Esc'."

restores plugins from a snapshot = ":PlugRestore <filename>" 
creates a snapshot of the current plugin setup = ":PlugSnapshot <filename>" 
shows differences from the last update = ":PlugDiff"
update npm = "npm install -g npm"
update all the Node.js packages installed globally on your system = "npm update -g" 
upgrades vim-plug itself = ":PlugUpgrade"
check health = ":checkhealth"
install = ":PlugInstall"
update = ":PlugUpdate"
clean = ":PlugClean"
status = ":PlugStatus"
":CocList extensions
":CocInstall coc-python
":CocInstall coc-sh
":CocInstall coc-yaml
":CocInstall coc-toml

[virtual Environment (venv)]

enter virtual environment = "source /path/to/venv/bin/activate"
lists outdated packages = "pip list --outdated"
update a specific package = "pip install --upgrade package-name"
deactivate the virtual environment when done = "deactivate"
update npm itself = "npm install -g npm"
update all global npm packages = "npm update -g"
to update nvm itself you typically need to run the install script again as nvm does not have a dedicated "update" command = "curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash"
source the nvm script to reload nvm you might add this to your .bashrc or .bash_profile to automate it = "source ~/.nvm/nvm.sh"
install the latest Node.js version and use it = "nvm install node"
switch to using the latest version = "nvm use node"
set the latest Node.js version as the default = "nvm alias default node"

I keep similar lists to help me remember/find the correct command I want


Yeah, lol just makes sense… quicker to find with Ctrl f than searching online

hahaha I just did Ctrl f for the first time on a wiki page and easily found what i wanted. Nice!

1 Like

This and there are times when I don’t have data or my internet is playing up

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.