Difference between revisions of "User:Cyrusty/Useful Commands"
(Created page with "== 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...") |
m (→Useful Commands and Info) |
||
Line 2: | Line 2: | ||
ls-al #lists all in current directory | ls-al #lists all in current directory | ||
+ | |||
rm -rf FILENAMEHERE # deletes files or directories | rm -rf FILENAMEHERE # deletes files or directories | ||
+ | |||
chmod +x FILENAME #sets all permissions | chmod +x FILENAME #sets all permissions | ||
+ | |||
mv /FILE/NAME /NEW/LOCATION #moves files | mv /FILE/NAME /NEW/LOCATION #moves files | ||
+ | |||
mv /FILE/NAME NEWFILENAMEHERE #renames the file | mv /FILE/NAME NEWFILENAMEHERE #renames the file | ||
+ | |||
pwd #prints working directory | pwd #prints working directory | ||
+ | |||
top #shows all running processes | top #shows all running processes | ||
+ | |||
kill xxxx #choose the process number to kill the running application | kill xxxx #choose the process number to kill the running application | ||
+ | |||
tar xzvf FILENAME #extracts zip files | tar xzvf FILENAME #extracts zip files | ||
+ | |||
crontab -e #access boot services | crontab -e #access boot services | ||
+ | |||
@reboot<TAB> /DESTINATION/OF/FILE/FILENAME #Run a program when rebooting | @reboot<TAB> /DESTINATION/OF/FILE/FILENAME #Run a program when rebooting | ||
+ | |||
ifconfig #shows internet config | ifconfig #shows internet config | ||
+ | |||
whoami #shows current user | whoami #shows current user | ||
+ | |||
ps #shows running processes | ps #shows running processes | ||
+ | |||
sudo nano etc/default/grub #grub info | sudo nano etc/default/grub #grub info | ||
+ | |||
sudo update-grub #update after making edits to grub | sudo update-grub #update after making edits to grub | ||
+ | |||
alias NAME="SOMECOMMAND HERE" #creates and alias for a command | alias NAME="SOMECOMMAND HERE" #creates and alias for a command | ||
+ | |||
chown -R USER:USER FILE/NAME #change all permission | 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 | ln -s /PATH/TO/SOMETHING/REAL /usr/local/bin/NAME #makes a file you choose to run by typing an alias | ||
Commands for VPS | Commands for VPS | ||
+ | |||
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 | ||
+ | |||
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 | ||
+ | |||
#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 | ||
+ | |||
Revision as of 08:17, 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
Show all the stuff I've tried to install or remove:
cat ~/.bash_history | grep apt-get
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.