Difference between revisions of "User:Cyrusty/Useful Commands"

From Organic Design wiki
m
m
Line 101: Line 101:
 
# If you want to rename for faster access do the following
 
# If you want to rename for faster access do the following
 
sudo nano /etc/hosts #add a new line and put IP_ADDRESS_OF_SERVER NAMEWANTED  
 
sudo nano /etc/hosts #add a new line and put IP_ADDRESS_OF_SERVER NAMEWANTED  
 +
can also do the following
 +
sudo echo "REMOTEIP INSERTPREFERREDNAME" >> /etc/hosts # does the same as above
 
</source>
 
</source>
 
==Other Info==
 
==Other Info==

Revision as of 09:09, 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


ssh -NCD 1080 USER@SERVERIP # go to firefox change to manual proxy and enter for Port 1080, no proxy for:localhost, 127.0.0.1 ## this will show put traffic through a VPN


1. Firstly change the ssh password authentication to yes
sudo nano /etc/ssh/sshd_config # modifies ssh parameters
2. ssh-copy-id NAME@IP # this uploads pub key to authorized keys
3. sudo service ssh restart 
# If you want to rename for faster access do the following
sudo nano /etc/hosts #add a new line and put IP_ADDRESS_OF_SERVER NAMEWANTED 
can also do the following
sudo echo "REMOTEIP INSERTPREFERREDNAME" >> /etc/hosts # does the same as above

Other Info

cat ~/.bash_history | grep apt-get # Show all the stuff I've tried to install or remove


ssh -NR 1234:localhost:22 cy.rusty.space # Make an SSH connection to my machine temporarily available on port 1234 in the server:

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.