{"id":43,"date":"2024-03-20T16:08:18","date_gmt":"2024-03-20T16:08:18","guid":{"rendered":"https:\/\/paradoxa.me\/?p=43"},"modified":"2024-04-17T11:35:51","modified_gmt":"2024-04-17T11:35:51","slug":"linux-terminal-command-function","status":"publish","type":"post","link":"https:\/\/paradoxa.me\/index.php\/2024\/03\/20\/linux-terminal-command-function\/","title":{"rendered":"~ Linux Terminal Command\/Function"},"content":{"rendered":"\r\n<h1 style=\"text-align: center;\">Linux terminal command ( Arch and Debian )<\/h1>\r\n\r\n\r\n\r\n<ul class=\"wp-block-list\">\r\n<li style=\"text-align: left;\"><strong>~ <\/strong>: home directory<\/li>\r\n<li><strong># <\/strong>: Root<\/li>\r\n<li><strong>$ <\/strong>: User<\/li>\r\n<li><strong>&amp;<\/strong> : run commands in the background of your terminal<\/li>\r\n<li><strong>&amp;&amp;<\/strong> : combine multiple commands together<\/li>\r\n<li><strong>&gt;<\/strong> : re-director, take the output from a command (such as using cat to output a file) and direct it elsewhere<\/li>\r\n<li><strong>&gt;&gt;<\/strong> : similar to &gt; but instead of replacing the output, it will add it to the one already present<\/li>\r\n<li><strong>&#8211;help <\/strong>or <strong>-h <\/strong>: put after the command name will show the help menu<\/li>\r\n<li><strong>adduser <em>username<\/em><\/strong> : to add a user<\/li>\r\n<li><strong>alias <\/strong>: shows the shell&#8217;s aliases<\/li>\r\n<li><strong>apt search <em>packagename<\/em><\/strong> : search all the package with that name on it<\/li>\r\n\r\n\r\n\r\n<li style=\"text-align: left;\"><strong>apt update<\/strong> : Debian update the system by downloading new packages<\/li>\r\n\r\n\r\n\r\n<li style=\"text-align: left;\"><strong>apt upgrade<\/strong> : Debian install the downloaded packages<\/li>\r\n\r\n\r\n\r\n<li style=\"text-align: left;\"><strong>apt install<\/strong> : Debian install a program\/application<\/li>\r\n\r\n\r\n\r\n<li style=\"text-align: left;\"><strong>apt remove<\/strong> : Debian remove program\/application<\/li>\r\n<li><strong>apt autoremove<\/strong> : Debian remove program\/application orphan dependencies<\/li>\r\n\r\n\r\n\r\n<li style=\"text-align: left;\"><strong>bc<\/strong> : basic calculator<\/li>\r\n\r\n\r\n\r\n<li style=\"text-align: left;\"><strong>cat<\/strong> : shows every line inside the file from the terminal<\/li>\r\n\r\n\r\n\r\n<li style=\"text-align: left;\"><strong>cd <\/strong>: change directory (<em>&#8220;cd download<\/em>&#8221; if you want to go to the download directory)<\/li>\r\n\r\n\r\n\r\n<li style=\"text-align: left;\"><strong>cd &#8211;\u00a0<\/strong>or\u00a0<strong>cd ..<\/strong> : to go back to the previous directory<\/li>\r\n<li><strong>chage -E <em>date user<\/em><\/strong> : set expiration date for the user<\/li>\r\n<li><strong>chage -l <em>user<\/em><\/strong> : shows the expiration date of the user ( type <em>-1<\/em> for never )<\/li>\r\n<li><strong>chage -M <em>days user<\/em><\/strong> : to set the number of days the user had to change password<\/li>\r\n\r\n\r\n\r\n<li style=\"text-align: left;\"><strong>chmod<\/strong> : change file permission (Example: 764 = rwxrw-r&#8211;)<br \/><strong>[d<\/strong>|rwx|<strong>rwx<\/strong>|rwx = <strong>dir\/file<\/strong>|user|<strong>group<\/strong>|other<strong>]\u00a0 <\/strong><strong>[<\/strong>4+2+1 = <strong>rwx<\/strong> = <strong>r<\/strong>ead <strong>w<\/strong>rite e<strong>x<\/strong>ecute<strong>]<\/strong><\/li>\r\n<li><strong>chmod +x\u00a0<em>filename<\/em> <\/strong>: add execute to all<\/li>\r\n<li><strong>chmod -x <em>filename<\/em> <\/strong>: remove execute to all<\/li>\r\n<li><strong>chmod u+x <em>filename<\/em> <\/strong>: add execute to user only<\/li>\r\n<li><strong>chsh -l<\/strong> : to check the path of the shell<\/li>\r\n<li><strong>chsh -s <em>\/path\/of\/the\/shell<\/em> <\/strong>: to set the new shell for the user<\/li>\r\n\r\n\r\n\r\n<li style=\"text-align: left;\"><strong>clear<\/strong> or <strong>&#8220;Ctrl&#8221; + &#8220;l&#8221;<\/strong> : clear the terminal<\/li>\r\n\r\n\r\n\r\n<li style=\"text-align: left;\"><strong>&#8220;Ctrl&#8221; + &#8220;+&#8221;<\/strong> : zoom in<\/li>\r\n\r\n\r\n\r\n<li style=\"text-align: left;\"><strong>&#8220;Ctrl&#8221; + &#8220;-&#8220;<\/strong> : zoom out<\/li>\r\n\r\n\r\n\r\n<li style=\"text-align: left;\"><strong>cp\u00a0<em>filename directory<\/em><\/strong> : copy and paste the file in the directory<em><br \/><\/em><\/li>\r\n\r\n\r\n\r\n<li style=\"text-align: left;\"><strong>date<\/strong> : shows the date<\/li>\r\n<li><strong>df -h<\/strong> : shows availible and used disk\/partiton space<\/li>\r\n<li><strong>diff <em>filename1.txt filename2.txt <\/em><\/strong>: to check if there is difference inside the files<\/li>\r\n<li><strong>echo<\/strong> : displays what did you type<\/li>\r\n<li><strong>EDITOR=nano visudo<\/strong> :from root to edit with nano \/etc\/sudoers privileges (if member of the wheel: remove #)<\/li>\r\n<li><strong>fdisk<\/strong> : to start modifying the disk partitions (umount device first)<\/li>\r\n<li><strong>fdisk -l<\/strong> : shows disk and partitions<\/li>\r\n<li><strong>free<\/strong> : shows memory and swap usage in byte<\/li>\r\n<li><strong>free -m<\/strong> : shows memory and swap usage in Mb<\/li>\r\n\r\n\r\n\r\n<li style=\"text-align: left;\"><strong>grep\u00a0<em>word filename<\/em><\/strong> : shows the specific word in a specific file<\/li>\r\n<li><strong>grep\u00a0<em>word *<\/em><\/strong> : shows the specific word in every file in that directory<\/li>\r\n<li><strong>grep -c <em>word filename<\/em><\/strong> : count how many time the word is in that file<\/li>\r\n<li><strong>grep -i <em>word filename<\/em><\/strong> : same as grep alone but with no case sensitivity<\/li>\r\n<li><strong>grep -n <em>word filename<\/em><\/strong> : same as grep but shows also the line number<\/li>\r\n<li><strong>grep -r <em>word \/path\/ <\/em><\/strong>: shows the word inside every file and evry folder from that path\u00a0<\/li>\r\n<li><strong>grep -v <em>word filename<\/em><\/strong> : shows every line apart for the one containing that word<\/li>\r\n<li><strong>grep -name <em>filename <\/em><\/strong>: to look for a specific file<\/li>\r\n<li><strong>groups <em>user<\/em><\/strong> : to check all the groups that the specific user is in<\/li>\r\n<li><strong>help<\/strong> : help page documentation of the program selected<\/li>\r\n\r\n\r\n\r\n<li style=\"text-align: left;\"><strong>head<\/strong> : print out first 10 line on the selected file<\/li>\r\n\r\n\r\n\r\n<li style=\"text-align: left;\"><strong>history<\/strong> : it will show the command history<\/li>\r\n<li><strong>htop<\/strong> : system monitor<\/li>\r\n<li><strong>id <\/strong>: user identity<\/li>\r\n<li><strong>ip <\/strong>: shows\/manipulate routing, net devices and so on<\/li>\r\n\r\n\r\n\r\n<li style=\"text-align: left;\"><strong>ip address<\/strong> : shows your IP address<\/li>\r\n\r\n\r\n\r\n<li style=\"text-align: left;\"><strong>kill <\/strong>: close the program<\/li>\r\n\r\n\r\n\r\n<li style=\"text-align: left;\"><strong>less<\/strong> : similar to cat, mainly used for longer files<\/li>\r\n\r\n\r\n\r\n<li style=\"text-align: left;\"><strong>locate<\/strong> : locate the file or directory<\/li>\r\n\r\n\r\n\r\n<li style=\"text-align: left;\"><strong>ls<\/strong> : list file and directory<\/li>\r\n<li><strong>ls \/<\/strong> : list files in the fist directory<\/li>\r\n\r\n\r\n\r\n<li style=\"text-align: left;\"><strong>ls -a<\/strong> : list all file and directory (even the hidden one)<\/li>\r\n\r\n\r\n\r\n<li style=\"text-align: left;\"><strong>ls -all <\/strong>or<strong> ll -a <\/strong>: list all file and directory + other information<\/li>\r\n\r\n\r\n\r\n<li style=\"text-align: left;\"><strong>ls -lah <\/strong>: list all file and directory + other information in human readable number 4k instead 4000<\/li>\r\n<li><strong>lsblk<\/strong> : list all disks and partitions<\/li>\r\n<li><strong>lsplug<\/strong> : list all usb devices<\/li>\r\n<li><strong>lspci<\/strong> : list pci devices<\/li>\r\n\r\n\r\n\r\n<li style=\"text-align: left;\"><strong>man<\/strong> : manual, it&#8217;s basically the manual for another program, you can even type &#8220;<em>man man<\/em>&#8220;<\/li>\r\n<li><strong>makepkg -s<\/strong> : run the command inside the directory of the <em>tar -xvf<\/em> extracted file to create an installation file<\/li>\r\n\r\n\r\n\r\n<li style=\"text-align: left;\"><strong>mkdir<\/strong> : create a directory (folder)<\/li>\r\n<li><strong>mkfs<\/strong><em><strong>.typefile \/dev\/devname<\/strong><\/em>: to format the disk with the type file (ext4\/exfat). create 1st partitions with fdisk<\/li>\r\n<li><strong>mkfs.<em>ext4<\/em> -n &#8220;<em>label<\/em>&#8221; <em>\/dev\/devname<\/em><\/strong> : to label the device or partition<\/li>\r\n<li><strong>mount<\/strong> : shows all the volumes on every disk<\/li>\r\n<li><strong>mount | grep <em>diskname<\/em><\/strong> : filter only the volumes on the specified disk<\/li>\r\n\r\n\r\n\r\n<li style=\"text-align: left;\"><strong>mv<\/strong> <em><strong>filename directory <\/strong><\/em>: move file to directory<\/li>\r\n<li><strong>mv <em>filename1 filename2 <\/em><\/strong>: to rename file<\/li>\r\n<li><strong>mv *.<em>txt directory <\/em><\/strong>: to move all file with that extension<\/li>\r\n<li><strong>ncdu<\/strong> : shows how much space is used and by which folder inside the directory<\/li>\r\n<li><strong>ncdu \/<\/strong> : shows for the all system<\/li>\r\n<li><strong>ncdu \/ -x <\/strong>: same as above but only for the local system, excludes the external drives<\/li>\r\n<li><strong>net <\/strong>: tool to administrate samba and CIFS servers<\/li>\r\n<li><strong>nmap -sV <em>ipaddress <\/em><\/strong>: shows port and version<\/li>\r\n<li><strong>nmap -v <\/strong>: check the nmap version<\/li>\r\n<li><strong>nmap <em>ipaddress.0\/24 <\/em><\/strong>: scan entire subnet (<strong>nmap -sP <em>ipsubnet<\/em> <\/strong>shows a simplified view)<\/li>\r\n<li><strong>nmap <em>ipaddress or hostname <\/em><\/strong>: to scan all the ports on that system<\/li>\r\n<li><strong>nmap -T5 <em>ipaddress <\/em><\/strong>: to scan at maximum speed<br \/>[ From <strong>T1<\/strong> (slower but less detectable) to <strong>T5<\/strong> (faster and less accurate), default is set to <strong>T3<\/strong>]<\/li>\r\n<li><strong>pacman -Qdt<\/strong> : queering package database for orphans, so they can be removed<\/li>\r\n<li><strong>pacman -R<\/strong>: Arch program remove<\/li>\r\n<li><strong>pacman -S<\/strong>: Arch program install<\/li>\r\n<li><strong>pacman -Ss <em>keyword <\/em><\/strong>: Arch program search for packages using keyword<\/li>\r\n<li><strong>pacman -Syu<\/strong> : Arch to update\/upgrade<\/li>\r\n<li><strong>pacman -Syy<\/strong> : Arch refresh package databese<\/li>\r\n<li><strong>pacman -U <em>filename<\/em><\/strong> : use it inside the directory where the file to install the selected file after <em>makepg -s <\/em><\/li>\r\n<li><strong>passwd -l <em>user<\/em><\/strong> : lock the user sccount<\/li>\r\n<li><strong>passwd -u <em>user<\/em><\/strong> : unlock the user sccount<\/li>\r\n\r\n\r\n\r\n<li style=\"text-align: left;\"><strong>ping<\/strong> <strong><em>ipaddress<\/em><\/strong>: test and send packages to the specify web address<\/li>\r\n<li><strong>ps <\/strong>: process status<\/li>\r\n\r\n\r\n\r\n<li style=\"text-align: left;\"><strong>pwd <\/strong>: print working directory (shows you where you are)<\/li>\r\n<li><strong>reboot <\/strong>: reboot the system<\/li>\r\n\r\n\r\n\r\n<li style=\"text-align: left;\"><strong>rmdir<\/strong> : remove directory<\/li>\r\n\r\n\r\n\r\n<li style=\"text-align: left;\"><strong>rm\u00a0<em>filename<\/em><\/strong> : remove file<\/li>\r\n<li><strong>rm -rf <em>directory or filename<\/em><\/strong> : forcefully remove directory and all it&#8217;s files<\/li>\r\n<li><strong>samba <\/strong>: server that provides services to clieants<\/li>\r\n<li><strong>sar -b <\/strong>: to check why system is slowing down<\/li>\r\n<li><strong>sar -r <\/strong>: to check current memory<\/li>\r\n<li><strong>sar -S <\/strong>: to check current swap<\/li>\r\n<li><strong>sar -u <\/strong>: to check current cpu usage<\/li>\r\n<li><strong>sar -u -f \/etc\/var\/log\/sysstat\/<em>filename<\/em><\/strong> : to check the specific log that was saved<\/li>\r\n<li><strong>ss <\/strong>: investigate sockets<\/li>\r\n<li><strong>ssh <em>username<\/em>@<em>ipaddress <\/em><\/strong>: to log in using ssh<\/li>\r\n<li><strong>su<\/strong> : to switch to root<\/li>\r\n<li><strong>su <em>username<\/em><\/strong> : to switch to the username<\/li>\r\n\r\n\r\n\r\n<li style=\"text-align: left;\"><strong>sudo<\/strong> : obtain administrator privileges<\/li>\r\n<li><strong>sudo !!<\/strong> : to run the last command if you forgot to put sudo on the front<\/li>\r\n\r\n\r\n\r\n<li style=\"text-align: left;\"><strong>tail<\/strong> : print out last 10 line of the select file<\/li>\r\n<li><strong>tar -xvf <em>filename <\/em><\/strong>: extract the <em>wget<\/em> downloaded compressed file<\/li>\r\n<li><strong>time <em>commandname <\/em><\/strong>: shows how much time the command took<\/li>\r\n\r\n\r\n\r\n<li style=\"text-align: left;\"><strong>top<\/strong> : shows all the running program<\/li>\r\n\r\n\r\n\r\n<li style=\"text-align: left;\"><strong>touch <em>filename.txt<\/em><\/strong> : to create a text file (or you can create one with the text editor: <em>nano filename<\/em>)<em><br \/><\/em><\/li>\r\n<li><strong>umount <em>\/dev\/devname<\/em><\/strong> : unmount the device or partition but still able to see it<\/li>\r\n<li><strong>unalias <em>aliasname <\/em><\/strong>: remove the alias<\/li>\r\n<li><strong>uname <\/strong>: info on device<\/li>\r\n<li><strong>usermod -aG <em>group<\/em> <em>user<\/em><\/strong> : add the specific user to the specific group ( type &#8221; , &#8221; without spaces to add more groups )<\/li>\r\n<li><strong>usermod -d <em>\/testhome\/testdir\/<\/em> &#8211;move-home <em>username<\/em><\/strong> : to move the user&#8217;s home directory to a new one with all it&#8217;s file<strong>s<\/strong><\/li>\r\n<li><strong>usermod -e <em>date user<\/em><\/strong> : to set an expiration date for the user<\/li>\r\n<li><strong>usermod -l <em>newname oldname<\/em><\/strong> : to change user&#8217;s name<\/li>\r\n<li><strong>usermod -L <em>user<\/em><\/strong> : to lock that specific user<\/li>\r\n<li><strong>usermod -U <em>user<\/em><\/strong> : to unlock that specific user<\/li>\r\n<li><strong>visudo<\/strong> : to edit configuration file, temporary saves it and checks the syntax for error<\/li>\r\n\r\n\r\n\r\n<li style=\"text-align: left;\"><strong>wget<\/strong> : non interactive network downloader &#8220;<em>wget URL<\/em>&#8220;<\/li>\r\n\r\n\r\n\r\n<li style=\"text-align: left;\"><strong>whereis<\/strong> : path the command select + man page<\/li>\r\n\r\n\r\n\r\n<li style=\"text-align: left;\"><strong>which\u00a0<em>command<\/em><\/strong> : path to the command select <em>&#8220;which ls&#8221;<\/em><\/li>\r\n<li><strong>who <\/strong>: who is logged in<\/li>\r\n<li><strong>whoami <\/strong>: to check the name user<\/li>\r\n<li><strong>yay<\/strong> : same as pacman but for AUR (automated)<\/li>\r\n<li><strong>yay -Syu<\/strong> : update\/upgrade standard and AUR<\/li>\r\n<\/ul>\r\n\r\n\r\n\r\n<p>&nbsp;<\/p>\r\n","protected":false},"excerpt":{"rendered":"<p>List of all the command I use while I learn the terminal<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":29,"footnotes":""},"categories":[24,19],"tags":[21,20],"class_list":["post-43","post","type-post","status-publish","format-standard","hentry","category-linux","category-software","tag-linux","tag-software"],"_links":{"self":[{"href":"https:\/\/paradoxa.me\/index.php\/wp-json\/wp\/v2\/posts\/43","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/paradoxa.me\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/paradoxa.me\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/paradoxa.me\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/paradoxa.me\/index.php\/wp-json\/wp\/v2\/comments?post=43"}],"version-history":[{"count":80,"href":"https:\/\/paradoxa.me\/index.php\/wp-json\/wp\/v2\/posts\/43\/revisions"}],"predecessor-version":[{"id":222,"href":"https:\/\/paradoxa.me\/index.php\/wp-json\/wp\/v2\/posts\/43\/revisions\/222"}],"wp:attachment":[{"href":"https:\/\/paradoxa.me\/index.php\/wp-json\/wp\/v2\/media?parent=43"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/paradoxa.me\/index.php\/wp-json\/wp\/v2\/categories?post=43"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/paradoxa.me\/index.php\/wp-json\/wp\/v2\/tags?post=43"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}