Difference between revisions of "User:Cyrusty/Useful Commands"
From Organic Design wiki
m (→Useful Commands and Info) |
m (→Useful Commands and Info) |
||
Line 1: | Line 1: | ||
== Useful Commands and Info == | == Useful Commands and Info == | ||
+ | <source lang="bash"> | ||
ls-al #lists all in current directory | ls-al #lists all in current directory | ||
+ | </source> | ||
+ | <source lang="bash"> | ||
rm -rf FILENAMEHERE # deletes files or directories | rm -rf FILENAMEHERE # deletes files or directories | ||
+ | </source> | ||
+ | <source lang="bash"> | ||
chmod +x FILENAME #sets all permissions | chmod +x FILENAME #sets all permissions | ||
+ | </source> | ||
+ | <source lang="bash"> | ||
mv /FILE/NAME /NEW/LOCATION #moves files | mv /FILE/NAME /NEW/LOCATION #moves files | ||
+ | </source> | ||
+ | <source lang="bash"> | ||
mv /FILE/NAME NEWFILENAMEHERE #renames the file | mv /FILE/NAME NEWFILENAMEHERE #renames the file | ||
+ | </source> | ||
+ | <source lang="bash"> | ||
pwd #prints working directory | pwd #prints working directory | ||
+ | </source> | ||
+ | <source lang="bash"> | ||
top #shows all running processes | top #shows all running processes | ||
+ | </source> | ||
+ | <source lang="bash"> | ||
kill xxxx #choose the process number to kill the running application | kill xxxx #choose the process number to kill the running application | ||
+ | </source> | ||
+ | <source lang="bash"> | ||
tar xzvf FILENAME #extracts zip files | tar xzvf FILENAME #extracts zip files | ||
+ | </source> | ||
+ | <source lang="bash"> | ||
crontab -e #access boot services | crontab -e #access boot services | ||
+ | </source> | ||
+ | <source lang="bash"> | ||
@reboot<TAB> /DESTINATION/OF/FILE/FILENAME #Run a program when rebooting | @reboot<TAB> /DESTINATION/OF/FILE/FILENAME #Run a program when rebooting | ||
+ | </source> | ||
+ | |||
+ | <source lang="bash"> | ||
ifconfig #shows internet config | ifconfig #shows internet config | ||
+ | </source> | ||
+ | <source lang="bash"> | ||
whoami #shows current user | whoami #shows current user | ||
+ | </source> | ||
+ | <source lang="bash"> | ||
ps #shows running processes | ps #shows running processes | ||
+ | </source> | ||
+ | <source lang="bash"> | ||
sudo nano etc/default/grub #grub info | sudo nano etc/default/grub #grub info | ||
+ | </source> | ||
+ | <source lang="bash"> | ||
sudo update-grub #update after making edits to grub | sudo update-grub #update after making edits to grub | ||
+ | </source> | ||
+ | <source lang="bash"> | ||
alias NAME="SOMECOMMAND HERE" #creates and alias for a command | alias NAME="SOMECOMMAND HERE" #creates and alias for a command | ||
+ | </source> | ||
+ | <source lang="bash"> | ||
chown -R USER:USER FILE/NAME #change all permission | chown -R USER:USER FILE/NAME #change all permission | ||
+ | </source> | ||
+ | <source lang="bash"> | ||
ln -s /PATH/TO/SOMETHING/REAL /usr/local/bin/NAME #makes a file you choose to run by typing an alias | ln -s /PATH/TO/SOMETHING/REAL /usr/local/bin/NAME #makes a file you choose to run by typing an alias | ||
+ | </source> | ||
− | Commands for VPS | + | ==Commands for VPS== |
+ | <source lang="bash"> | ||
scp /home/USER root@MY-VPS-IP:home/USER #sends files from localmachine to VPS | scp /home/USER root@MY-VPS-IP:home/USER #sends files from localmachine to VPS | ||
+ | </source> | ||
+ | <source lang="bash"> | ||
scp root@VPSIP:/INSERT_FILE_DIRECTORY_HERE /home/USER/WHEREVER #sends files VPS to PC | scp root@VPSIP:/INSERT_FILE_DIRECTORY_HERE /home/USER/WHEREVER #sends files VPS to PC | ||
− | + | </source> | |
#to do a whole folder put -r eg.. scp -r /home/USER/FOLDER root@MY-VPS-UP:/home/USER | #to do a whole folder put -r eg.. scp -r /home/USER/FOLDER root@MY-VPS-UP:/home/USER | ||
− | |||
− | |||
<source lang="bash"> | <source lang="bash"> | ||
− | cat ~/.bash_history | grep apt-get | + | cat ~/.bash_history | grep apt-get #Show all the stuff I've tried to install or remove |
</source> | </source> | ||
Revision as of 08:37, 28 April 2018
Useful Commands and Info
ls-al #lists all in current directory
rm -rf FILENAMEHERE # deletes files or directories
chmod +x FILENAME #sets all permissions
mv /FILE/NAME /NEW/LOCATION #moves files
mv /FILE/NAME NEWFILENAMEHERE #renames the file
pwd #prints working directory
top #shows all running processes
kill xxxx #choose the process number to kill the running application
tar xzvf FILENAME #extracts zip files
crontab -e #access boot services
@reboot<TAB> /DESTINATION/OF/FILE/FILENAME #Run a program when rebooting
ifconfig #shows internet config
whoami #shows current user
ps #shows running processes
sudo nano etc/default/grub #grub info
sudo update-grub #update after making edits to grub
alias NAME="SOMECOMMAND HERE" #creates and alias for a command
chown -R USER:USER FILE/NAME #change all permission
ln -s /PATH/TO/SOMETHING/REAL /usr/local/bin/NAME #makes a file you choose to run by typing an alias
Commands for VPS
scp /home/USER root@MY-VPS-IP:home/USER #sends files from localmachine to VPS
scp root@VPSIP:/INSERT_FILE_DIRECTORY_HERE /home/USER/WHEREVER #sends files VPS to PC
- to do a whole folder put -r eg.. scp -r /home/USER/FOLDER root@MY-VPS-UP:/home/USER
cat ~/.bash_history | grep apt-get #Show all the stuff I've tried to install or remove
Make an SSH connection to my machine temporarily available on port 1234 in the server:
ssh -NR 1234:localhost:22 cy.rusty.space
When you're not sure what the syntax is type apropos KEYWORD #helps find the correct syntax user is looking for
If a file in the shell has spacebars used instead of _ or - I need to use a backward \ if I'm trying to do anything with it.