Linux for Beginners
Rate it:
Open Preview
69%
Flag icon
If you are looking for a more interactive experience where you can examine the local and remote file systems, use SFTP. With SCP you need to know what files you want to transfer before using the command.
Paweł Cisło
SFTP vs SCP
69%
Flag icon
sftp> pwd Remote working directory: /home/bob
70%
Flag icon
sftp> lpwd Local working directory: /tmp
70%
Flag icon
sftp> lls file1.txt
70%
Flag icon
Using scp, you can copy from your local system to a remote system, from a remote system to your local system, or from one remote system to another remote system.
Paweł Cisło
SCP
70%
Flag icon
FTP is not using a secure transfer protocol like SCP and SFTP. This means that your login credentials are sent in plain text over the network. Also, the files that you upload and download are not encrypted either. If given the choice between SCP/SFTP or FTP, use SCP/SFTP.
Paweł Cisło
FTP
70%
Flag icon
If FTP is not enabled, you will see a "Connection refused" error message.
74%
Flag icon
The contents of .profile or .bash_profile are only executed for interactive sessions.
74%
Flag icon
You can save yourself some hassle by making your interactive and non-interactive sessions behave the same. To do this, configure .bash_profile to reference .bashrc and put all of your configuration in .bashrc.
74%
Flag icon
source filename - Read and execute commands from filename and return. Any variables created or modified in filename will remain available after the script completes.
Paweł Cisło
source
74%
Flag icon
. filename - Same as source filename.
Paweł Cisło
.
74%
Flag icon
$ cat .bash_profile # Put our settings in .bashrc so we have the same environment for login and non-login shells. if [ -f ~/.bashrc ]; then    source ~/.bashrc fi
75%
Flag icon
# - Octothorpe. Also known as a hash, square, pound sign, or number sign. This symbol precedes comments.
75%
Flag icon
!N - Repeat command line number N.
75%
Flag icon
!! - Repeat the previous command line.
75%
Flag icon
!string - Repeat the most recent command startin...
This highlight has been truncated due to consecutive passage length restrictions.
76%
Flag icon
If you want to execute the second to last command type !-2.
76%
Flag icon
By default bash retains 500 commands in your shell history. This is controlled by the HISTSIZE environment variable.
Paweł Cisło
HISTSIZE
79%
Flag icon
the greater-than symbol (>) in the above example. It is the secondary prompt string and can be customized by changing the PS2 environment variable.
80%
Flag icon
The variables that are not exported are called local variables.
81%
Flag icon
To display the currently running processes use the ps command. If no options are specified, ps displays the processes associated with your current session. To see every process including ones that are not owned by you, use ps -e. To see processes running by a specific user, use ps -u username
Paweł Cisło
ps
83%
Flag icon
Processes that are backgrounded still execute and perform their task, however they do not block you from entering further commands at the shell prompt.
83%
Flag icon
To background a process, place an ampersand (&) at the end of the command.
Paweł Cisło
&
83%
Flag icon
Ctrl-c - Kill the foreground process.
83%
Flag icon
Ctrl-z - Suspend the foreground process.
83%
Flag icon
$ ./long-running-program & [1] 22686 $ ps -p 22686
83%
Flag icon
When a command is backgrounded two numbers are displayed. The number in brackets is the job number and can be referred by preceding it with the percent sign.
83%
Flag icon
The plus sign (+) in the jobs output represents the current job while the minus sign (-) represents the previous job. The current job is considered to be the last job that was stopped while it was in the foreground or the last job started in the background. The current job can be referred to by %% or %+. If no job information is supplied to the fg or bg commands, the current job is operated upon. The previous job can be referred to by %-.
84%
Flag icon
To bring a job back to the foreground, type the name of the job or use the fg command. To foreground the current job execute %%, %+, fg, fg %%, fg %+, or fg %num. To foreground job number 3, execute %3 or fg %3.
84%
Flag icon
To background a suspended job type the name of the job followed by an ampersand or use bg followed by the job name.
Paweł Cisło
For example, bg %3
85%
Flag icon
You can stop or kill a background job using the kill command. For example, to kill job number 1 execute kill %1. To kill a job that is running in the foreground, type Ctrl-c.
85%
Flag icon
The default signal used by kill is termination. You will see this signal referred to as SIGTERM or TERM for short. Signals have numbers that correspond to their names. The default TERM signal is number 15. So running kill pid, kill -15 pid, and kill -TERM pid are all equivalent. If a process does not terminate when you send it the TERM signal, use the KILL signal which is number 9.
85%
Flag icon
Every minute the cron service checks to see if there are any scheduled jobs to run and if so runs them.
87%
Flag icon
Instead of using 0,30 for the minute field you could have used */2.
Paweł Cisło
Cron for every 30 mins
87%
Flag icon
If you want to run a job every minute for the first four minutes of the hour you can use this time specification: 0-4 * * * * command.
88%
Flag icon
If no arguments are supplied to su, it assumes you are trying to become the superuser. Executing su is the same as executing su root.
88%
Flag icon
- - A hyphen is used to provide an environment similar to what the user would expect had the user logged in directly.
Paweł Cisło
su dash argument
88%
Flag icon
bob@linuxsvr:~$ su -c 'echo $ORACLE_HOME' - oracle Password: /u01/app/oracle/product/current
89%
Flag icon
sudo -l - List available commands.
Paweł Cisło
sudo -l
89%
Flag icon
sudo su - - Switch to the superuser account with an environment like you would expect to see had you logged in as that user.
Paweł Cisło
sudo su -
89%
Flag icon
The output of sudo -l displays what commands can be executed with sudo and under which account. In the above example, sudo will not prompt for a password for the commands preceded with NOPASSWD.
90%
Flag icon
The package manager uses a package's metadata to automatically install the dependencies. Package managers keep track of what files belong to what packages, what packages are installed, and what versions of those packages are installed.
90%
Flag icon
The yum command line utility is a package management program for Linux distributions that use the RPM package manager. CentOS, Fedora, Oracle Linux, RedHat Enterprise Linux, and Scientific Linux are RPM based distributions on which you can use yum.
Paweł Cisło
yum
92%
Flag icon
In addition to the yum command, you can use the rpm command to interact with the package manager.
Paweł Cisło
rpm
92%
Flag icon
The Debian and Ubuntu distributions use a package manager called APT, the Advanced Packaging Tool. APT is comprised of a few small utilities with the two most commonly used ones being apt-cache and apt-get.
92%
Flag icon
apt-get remove package - Remove/uninstall package, leaving behind configuration files. apt-get purge package - Remove/uninstall package, deleting configuration files.
93%
Flag icon
In addition the apt utilities, you can use the dpkg command to interact with the package manager.
Paweł Cisło
dgpk
99%
Flag icon
The Linux kernel handles the interactions between the software running on the system and the hardware.
99%
Flag icon
If your goal is to eventually become a Linux system administrator, focus on CentOS or Ubuntu.
99%
Flag icon
CentOS is a Red Hat Enterprise Linux (RHEL) derivative. As a general rule, CentOS and RHEL are often found in corporate environments. Ubuntu is popular with startups and smaller companies that run their operations in the cloud.