Linux Introduction
This is often referred to as "GNU-Linux".
specific group of software and conventions.
adapt to account for differences in distributions.
How to setup
which provides a bash shell environment.
It runs within Windows instead of in a VM.
- macOS has similar but not the same tool chains.
- macOS includes the Bash shell.
- Go to applications and open up a terminal. There you go.
Using a Cloud Provider
and SSH connection.
download PuTTY to connect to the cloud server using SSH.
PuTTY.org
Download files from GitHub
# open property by clocking top left logo, to select font size # # To run a command as administrator (uer "root"), use "sudo". % man sudo_root # ctrl+shift+[+] # to enlarge % sudo apt install git ## to use git % git clone git://github.com/path/to/files
Command-Line basics
% Command Options Arguments
% ls -aFl /mnt/c/Users/username/Desktop % grep "findthis" file.in
General Commands
% cd % pwd % man cd % which ls % find . -name "*in" % grep pattern file.txt % sort -u file.txt % echo text % export PATH=.:$PATH % man nano % which nedit % which kate
login shell and profile
When bash is invoked as an interactive login shell, or as a non-interactive shell with the --login option, it first reads and executes commands from the file /etc/profile, if that file exists. After reading that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and reads and executes commands from the first one that exists and is readable. The --noprofile option may be used when the shell is started to inhibit this behavior.
When an interactive shell that is not a login shell is started, bash reads and executes commands from /etc/bash.bashrc and ~/.bashrc, if these files exist. This may be inhibited by using the --norc option. The --rcfile file option will force bash to read and execute commands from file instead of /etc/bash.bashrc and ~/.bashrc.
In general
.profile - for things not related to Bash, like environment variables PATH
.bashrc - for configuring the interactive Bash usage
like aliases, editor and prompt
% export VISUAL=vim % export EDITOR="$VISUAL" % export PS1="\u@\h\\$ " % export PS1="[\w] \!> " % export PS1="\u@\[\e[31m\]\h\[\e[m\] ".bash_profile - for make sure .profile and .bashrc are loaded for login shells - If .bash_profile is omitted, only .profile would be loaded.
% . ~/.profile % . ~/.bashrc
No comments:
Post a Comment