Linux for Beginners
Rate it:
Open Preview
5%
Flag icon
download a virtual disk image (VDI) from http://virtualboxes.org/ to use. I recommend that you download a CentOS or Ubuntu image unless you already know which Linux distribution you will be working with in the future.
Paweł Cisło
Virtualboxes.org
7%
Flag icon
The first time you connect to a particular server, PuTTY will ask to cache that server's host key.
9%
Flag icon
Having an SSH key without a passphrase can allow you to automate and schedule tasks that require logging in to remote systems.
9%
Flag icon
In order to create an SSH key on a Windows system, you will need PuTTYgen.
11%
Flag icon
I highly recommend naming the keys in the following format: id_rsa and id_rsa.pub or id_dsa and id_dsa.pub Otherwise, you will have to specify the location of your key when you use the ssh command or perform some additional configuration to tell SSH that your keys are not named in the standard way.
14%
Flag icon
(~). The tilde is a shorthand way of representing your home directory.
15%
Flag icon
/etc System configuration files.
15%
Flag icon
/var Variable data, most notably log files.
20%
Flag icon
man command - Displays the online manual for command
20%
Flag icon
exit, logout, or Ctrl-d - Exits the shell or your current session.
24%
Flag icon
environment variable that represents your previous working directory is OLDPWD. So, cd - and cd $OLDPWD are equivalent.
24%
Flag icon
Here are two ways to execute program. $ pwd /home/bob $ ./program $ /home/bob/program
26%
Flag icon
If you want to show a long ls listing with hidden files you could run ls -l -a or ls -la.
28%
Flag icon
A link is sometimes called a symlink, short for symbolic link. A link points to the location of the actual file or directory. You can operate on the link as if it were the actual file or directory. Symbolic links can be used to create shortcuts to long directory names. Another common use is to have a symlink point to the latest version of installed software as in this example.
Paweł Cisło
Symlink
29%
Flag icon
tree - List contents of directories in a tree-like format.
33%
Flag icon
If you happen to see an extra character at the end of the permissions string an alternative access control method has been applied. If you see a period (.), the file or directory has an SELinux (Security Enhanced Linux) security context applied to it. If you see a plus sign (+), ACLs (Access Control Lists) are in use.
35%
Flag icon
If you do not specify permissions following the equal sign, the permissions are removed.
40%
Flag icon
The mode supplied to umask works in the opposite way as the mode given to chmod. When you supply 7 to chmod, that is interpreted to mean all permissions on or rwx. When you supply 7 to umask, that is interpreted to mean all permissions off or ---
Paweł Cisło
chmod vs unmask
43%
Flag icon
There is a class of special modes. These modes are setuid, setgid, and sticky. Know that these special modes are declared by prepending a character to the octal mode that you normally use with umask or chmod. The important point here is to know that umask 0022 is the same as umask 022.
43%
Flag icon
setuid permission - Allows a process to run as the owner of the file, not the user executing it. setgid permission - Allows a process to run with the group of the file, not of the group of the user executing it. sticky bit - Prevents a user from deleting another user's files even if they would normally have permission to do so.
44%
Flag icon
Let's look at some examples. Let's say you are looking for a file or directory named "apache." You think it is in /opt somewhere and are not quite sure if it is "Apache" or "apache." You could provide find with the path of /opt, use -iname to ignore case, and look for "apache." $ find /opt -iname apache
Paweł Cisło
find example
46%
Flag icon
Every time you run the find command it evaluates each file and returns the appropriate response. This can be a slow process at times. For instance, if you are looking for a file on the system and cannot narrow its location down to a subdirectory you would run find / -name something. That command looks at each and every file on the system.
Paweł Cisło
find is slow
46%
Flag icon
If you know the file's name or at least part of its name and just want to know where it resides, the locate command is the right tool for that job. locate pattern - List files that match pattern.
Paweł Cisło
locate
46%
Flag icon
Once a day all the files on the system are indexed by a process called updatedb. When you run locate it is simply querying the index or database created by updatedb and not looking at each file on the system.
Paweł Cisło
updatedb
48%
Flag icon
if you are trying to keep up with changes that are being made in real time to a file, cat is not the best choice. A good example of files that can change often and rapidly are log files. For example, you may need to start a program and look at that program's log file to see what it is doing. For this case, use the tail -f file command. tail -f file - Follow the file. Displays data as it is being written to the file.
49%
Flag icon
vim [file] - Same as vi, but with more features.
51%
Flag icon
:w! - Forces the file to be saved even if the write permission is not set. This only works on files you own.
51%
Flag icon
:q! - Quit without saving changes made to the file.
51%
Flag icon
screenshot of vim. Tildes (~) represent lines beyond the end of the file.
52%
Flag icon
If you would like to insert a piece of text 80 times, type 80i and start entering the text.
52%
Flag icon
dw - Delete a word. To delete five words, type d5w. The repeating concept in vi shows up in many places. dd - Delete a line. To delete 3 lines, type 3dd. D - Delete from the current position to the end of the line.
55%
Flag icon
emacs - Emacs has a graphical mode, too. gedit - The default text editor for the Gnome desktop environment. gvim - The graphical version of vim. kedit - The default text editor for the KDE desktop environment.
56%
Flag icon
vimdiff file1 file2 - Highlight the differences between two files in the vim editor.
62%
Flag icon
sort -u file - Sort text in file, removing duplicate lines.
64%
Flag icon
If you run across an older version of tar without gzip compression built-in, you can use pipes to create compressed archives.
65%
Flag icon
There are three default types of input and output. They are standard input, standard output, and standard error.
65%
Flag icon
Linux represents practically everything as a file. This abstraction allows you to do powerful things like take the standard output of one command that would normally be displayed to your screen and use it as input to another command. It's easier to run cat file.txt | sort than it is to type the entire contents of file.txt as the input to the sort command.
66%
Flag icon
Use the greater-than sign (>) to redirect output and the less-than sign (<) to redirect input.
66%
Flag icon
> - Redirects standard output to a file, overwriting (truncating) any existing contents of the file. If no file exists, it creates one.
Paweł Cisło
>
66%
Flag icon
>> - Redirects standard output to a file and appends to any existing contents. If no file exists, it creates one.
Paweł Cisło
>>
66%
Flag icon
< - Redirects input from a file to the command preceding the less-than sign.
Paweł Cisło
<
66%
Flag icon
ls -lF /opt/apache > files.txt is the same as ls -lF /opt/apache 1> files.txt.
66%
Flag icon
sort < files.txt is the same as sort 0< files.txt.
67%
Flag icon
This example shows files.txt being redirected as input for the sort command. The output of the sort command is then redirected to the sorted_files.txt file. $ sort < files.txt > sorted_files.txt
Paweł Cisło
< and > combined
67%
Flag icon
To redirect the error messages you had to explicitly specify file descriptor 2 with 2>.
68%
Flag icon
If you want to capture both standard output and standard error, use 2>&1.
68%
Flag icon
& - Used with redirection to signal that a file descriptor is being used instead of a file name.
Paweł Cisło
&
68%
Flag icon
>/dev/null - Redirect output to nowhere.
69%
Flag icon
SCP and SFTP are both extensions of the secure shell (SSH) protocol.
69%
Flag icon
In order to use SCP or SFTP you need a client. Mac and Linux come with scp and sftp command line utilities. If you are running Windows, you can use the PuTTY Secure Copy Client (pscp.exe) and the PuTTY Secure File Transfer client (psftp.exe) programs.
« Prev 1 3