Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
linuxfind [2021/05/12 21:55]
bpienig
linuxfind [2021/05/12 22:11]
bpienig
Line 11: Line 11:
 View index of help pages: View index of help pages:
 <file bash>info</file> <file bash>info</file>
-===== Command Line Utilities ===== +==== Command Line Utilities ==== 
-==== Basic File and Directory Operations ====+=== Basic File and Directory Operations ===
 Print current working directory:  Print current working directory: 
 <file bash>pwd</file> <file bash>pwd</file>
Line 39: Line 39:
 Filesystem creation tool:  Filesystem creation tool: 
 <file bash>mkfs</file> <file bash>mkfs</file>
-==== System Administration ====+=== System Administration ===
 Execute command as an administrator (can be destructive/insecure. Use only for system administration tasks):  Execute command as an administrator (can be destructive/insecure. Use only for system administration tasks): 
 <file bash>sudo command</file> <file bash>sudo command</file>
Line 48: Line 48:
 Forgot to type sudo in front of a command and already hit enter? Repeat the last command using sudo:  Forgot to type sudo in front of a command and already hit enter? Repeat the last command using sudo: 
 <file bash>sudo !!</file> <file bash>sudo !!</file>
-==== Installing software from a .tgz (also known as a tarball) ====+=== Installing software from a .tgz (also known as a tarball) ===
 First, unzip the tarball (see section on tar, below)  First, unzip the tarball (see section on tar, below) 
 Next, move into unzipped directory Next, move into unzipped directory
Line 62: Line 62:
 Clean up files in directory, in case make command fails, or just to remove unnecessary cruft:  Clean up files in directory, in case make command fails, or just to remove unnecessary cruft: 
 <file bash>make clean</file> <file bash>make clean</file>
-==== Ubuntu/Debian Software repositories ==== +=== Ubuntu/Debian Software repositories ===
 Check distro repositories for software updates:  Check distro repositories for software updates: 
 <file bash>sudo apt-get update</file> <file bash>sudo apt-get update</file>
Line 75: Line 75:
 View the output of a command in a more convenient format:  View the output of a command in a more convenient format: 
 <file bash>command | less</file> <file bash>command | less</file>
-==== Working With Files ====+=== Working With Files ===
 Print a file in terminal:  Print a file in terminal: 
 <file bash>cat file</file> <file bash>cat file</file>
Line 87: Line 87:
 <file bash>command | grep phrase <file bash>command | grep phrase
 </file> </file>
-==== Working With Processes ====+=== Working With Processes ===
 List all running processes:  List all running processes: 
 <file bash>ps -e</file> <file bash>ps -e</file>
Line 103: Line 103:
 <file bash>nohup command & <file bash>nohup command &
 </file> </file>
-==== Compression and Encryption ====+=== Compression and Encryption ===
 Make a simple compressed backup of files or directories:  Make a simple compressed backup of files or directories: 
 <file bash>tar -cvzf backup/output.tgz target_files_or_directories</file> <file bash>tar -cvzf backup/output.tgz target_files_or_directories</file>
Line 114: Line 114:
 Zip and encrypt a directory simultaneously:  Zip and encrypt a directory simultaneously: 
 <file bash>gpg-zip -o encrypted_filename.tgz.gpg -c -s file_to_be_encrypted</file> <file bash>gpg-zip -o encrypted_filename.tgz.gpg -c -s file_to_be_encrypted</file>
-===== The Bash shell ===== +==== The Bash shell ==== 
-==== File Name expansions ====+=== File Name expansions ===
 Current user's home directory:  Current user's home directory: 
 <file bash>~/</file> <file bash>~/</file>
Line 127: Line 127:
 <file bash>/* <file bash>/*
 </file> </file>
-==== Output Redirects ====+=== Output Redirects ===
 Redirect output of one command into the input of another with a pipe:  Redirect output of one command into the input of another with a pipe: 
 <file bash>command_1 | command_2</file> <file bash>command_1 | command_2</file>
Line 145: Line 145:
 <file bash>command > /dev/null 2>&1 <file bash>command > /dev/null 2>&1
 </file> </file>
-==== Controlling Execution ====+=== Controlling Execution ===
 Wait until command 1 is finished to execute command 2  Wait until command 1 is finished to execute command 2 
 <file bash>command_1 ; command_2</file> <file bash>command_1 ; command_2</file>
Line 152: Line 152:
 && acts like ; but only executes command2 if command_1 indicates that it succeeded without error by returning 0.  && acts like ; but only executes command2 if command_1 indicates that it succeeded without error by returning 0. 
 <file bash>command_1 && command_2</file> <file bash>command_1 && command_2</file>
-\|\acts like && but only executes command2 if command1 indicates an error by returning 1. +double pipes || act like && but only executes command_2 if command_1 indicates an error by returning 1. 
 <file bash>command_1 || command_2 <file bash>command_1 || command_2
 </file> </file>
-==== Bash Wildcards ====+=== Bash Wildcards ===
 Zero or more characters:  Zero or more characters: 
 <file bash>  * </file> <file bash>  * </file>
Line 170: Line 170:
 ===== Advanced ===== ===== Advanced =====
 ==== Command Line Utilities, Continued ==== ==== Command Line Utilities, Continued ====
-==== Networking ====+=== Networking ===
 Configure network interfaces:  Configure network interfaces: 
 <file bash>ifconfig</file> <file bash>ifconfig</file>
Line 193: Line 193:
 Scan this machine(localhost) to check for open ports:  Scan this machine(localhost) to check for open ports: 
 <file bash>nmap localhost</file> <file bash>nmap localhost</file>
-==== wget ====+== wget ==
 download a file over http:  download a file over http: 
 <file bash>wget http://example.com/folder/file</file> <file bash>wget http://example.com/folder/file</file>
Line 202: Line 202:
 download a file from ftp server:  download a file from ftp server: 
 <file bash>wget --ftp-user=USER --ftp-password=PASS ftp://example.com/folder/file</file> <file bash>wget --ftp-user=USER --ftp-password=PASS ftp://example.com/folder/file</file>
-==== netcat ====+== netcat ==
 Listen for input from network on recieving_port, dump it to a file (insecure, but handy):  Listen for input from network on recieving_port, dump it to a file (insecure, but handy): 
 <file bash>netcat -l recieving/port > file/copied</file> <file bash>netcat -l recieving/port > file/copied</file>
Line 209: Line 209:
 Use tar to compress and output a file as a stream, pipe it to a target ip and port over the network:  Use tar to compress and output a file as a stream, pipe it to a target ip and port over the network: 
 <file bash>sudo tar -czf - filename | netcat -w number_of_seconds_before_timeout target_ip target_port</file> <file bash>sudo tar -czf - filename | netcat -w number_of_seconds_before_timeout target_ip target_port</file>
-==== Users and Groups ====+=== Users and Groups ===
 Change owner of a file or directory:  Change owner of a file or directory: 
 <file bash>chown user_name:group_name directory_name</file> <file bash>chown user_name:group_name directory_name</file>
Line 236: Line 236:
 Interactive talk program to talk to other users from terminal (must be installed from repositories.):  Interactive talk program to talk to other users from terminal (must be installed from repositories.): 
 <file bash>ytalk</file> <file bash>ytalk</file>
-==== Working With Files, Continued ====+=== Working With Files, Continued ===
 View what processes are using what files:  View what processes are using what files: 
 <file bash>lsof</file> <file bash>lsof</file>
Line 294: Line 294:
 Dump info about keyboard drivers:  Dump info about keyboard drivers: 
 <file bash>dumpkeys</file> <file bash>dumpkeys</file>
-==== Ubuntu System Administration, Advanced (Continued) ====+==== System Administration, Advanced (Continued) ====
 Add a Personal Package Archive from Ubuntu Launchpad:  Add a Personal Package Archive from Ubuntu Launchpad: 
 <file bash>add-apt-repository</file> <file bash>add-apt-repository</file>
Line 300: Line 300:
 <file bash>sudo dpkg -i package.deb <file bash>sudo dpkg -i package.deb
 </file> </file>
-==== Python ====+==== Development ==== 
 +=== Python ===
 Update pip (Python package manager):  Update pip (Python package manager): 
 <file bash>pip install -U pip</file> <file bash>pip install -U pip</file>
Line 318: Line 319:
 <file bash>pip install -E dirname -r requirements.txt <file bash>pip install -E dirname -r requirements.txt
 </file> </file>
-==== git ====+=== GIT ===
   All commands must be performed in the same directory as .git folder   All commands must be performed in the same directory as .git folder
      
Line 348: Line 349:
 <file bash>git branch <file bash>git branch
 </file> </file>
-==== Virtualization ==== +=== MySQL ===
-clone a virtual machine (this works, it's been tested):  +
-<file bash>vboxmanage clonehd virtual/machine/name.vdi --format VDI ~/target/virtual/machine_name.vdi</file> +
-mount a shared virtual folder:  +
-you need to make sure you have the right kernel modules. You can do this with modprobe, but this package works instead in a ubuntu-specific way.  +
-<file bash>sudo apt-get install virtualbox-ose-guest-utils +
-sudo mount -t vboxsf name/of/shared/folder/specified/in/Virtualbox path/of/mountpoint +
-</file> +
-==== mysql ====+
 Get help:  Get help: 
 <file bash>help</file> <file bash>help</file>
Line 383: Line 376:
 change user password:  change user password: 
 <file bash>use mysql; <file bash>use mysql;
-update user set password='password'('newpassword') where User='user_name';</file>+update user set password=password('newpassword') where User='user_name';</file>
 mysql command line args:  mysql command line args: 
 export text file with commands to rebuild all mysql tables:  export text file with commands to rebuild all mysql tables: 
Line 392: Line 385:
 <file bash>mysqldump -u username -p --opt databasename > dumpfile.sql</file> <file bash>mysqldump -u username -p --opt databasename > dumpfile.sql</file>
 restore from entire database dump:  restore from entire database dump: 
-<file bash>mysql -u username -p --database=databasename < dumpfile.sql+<file bash>mysql -u username -p --database=databasename < dumpfile.sql</file> 
 +==== Virtualization ==== 
 +clone a virtual machine (this works, it's been tested):  
 +<file bash>vboxmanage clonehd virtual/machine/name.vdi --format VDI ~/target/virtual/machine_name.vdi</file> 
 +mount a shared virtual folder:  
 +you need to make sure you have the right kernel modules. You can do this with modprobe, but this package works instead in a ubuntu-specific way.  
 +<file bash>sudo apt-get install virtualbox-ose-guest-utils 
 +sudo mount -t vboxsf name/of/shared/folder/specified/in/Virtualbox path/of/mountpoint 
 +</file>
  
 
 linuxfind.txt · Last modified: 2021/05/12 22:14 by bpienig
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
Recent changes RSS feed Driven by DokuWiki