An empty repo containing a list of useful Linux commands
cd
- change directoryls
- list files, see list of optionstouch
- create a filenano
- edit filecp <origin> <destination>
- copymv <origin> <destination>
- moverm <filename>
- removemkdir
- create directoryrmdir
- remove directorycat
- display content of a file
output > filename
- wipes content and writes outputoutput >> filename
- adds output to the existing content of the file
grep keyword <filename>
- lists search results after the keyword in a specific filediff file1 file2
- lists the differences between the 2 files
sha1sum <filename>
-
gzip <filename>
- compress file -
gunzip <filename>
- uncompress files -
tar cvf <targetfilename> <list of files>
- compress a list of files into an archive -
tar xvf <archivename>
- uncompresses the archive
-
sudo apt-get update
- update the advance package manager -
sudo apt-get install <packagename>
- install the specified package -
bash <scriptname>
- run shell scripts -
apt-get search <package-name-query>
- lists all the available packages with similar names as the query
sudo useradd <username>
- create usersudo passwd <username>
- set user password
sudo groupadd <groupname>
sudo usermod -a -G <groupname> <username>
sudo userdel <username>
ssh <username>@<ip_address>
- connects to the specified address with username
ssh-keygen -t rsa
- generate public / private rsa key pairssh-copy-id root@serveraddress
- adding ssh key to server
sftp <username>@<ip_address>
- connects to remote machine with SFTP enabledput <path/filename>
- uploads a file to the working directoryput -r <foldername>
- uploads a folder to the working directoryget <filename>
- downloads a file from serverget -r <foldername> <destination>
- downloads a folder from the server
ps
- list all your processesps ax
- list all system processes<program_name> &
- runs the program in the backgroundjobs
- list of jobs runningfg %<job number>
- brings job to foregroundCTRL+C
- terminates a processCTRL+Z
- pauses a processkill PID
- kill process directlykill -STOP PID
- stops a processkill -CONT PID
- resumes a process