Linux Resources
- Home
- Linux Resources
This article covers how you can download YouTube videos on Linux using the youtube-dl utility. The youtube-dl is a handy utility with a large feature set. However, there is a lot more you can do with this utility. To explore more features, visit its official documentation . To play the downloaded videos, you can use any media players like VLC , FFmpeg , and so on.
youtube-dl is a command-line program that lets you easily download videos and audio from more than a thousand websites.
youtube-dl is a Python based small command-line tool that allows to download videos from YouTube.com, Dailymotion, Google Video, Photobucket, Facebook, Yahoo, Metacafe, Depositfiles and few more similar sites.
It written in pygtk and requires Python interpreter to run this program, it's not platform restricted. It should run on any Unix, Windows or in Mac OS X based systems.
To Install YouTube-DL in RHEL/CentOS and Fedora:
The youtube-dl program can be installed by enabling epel repository under your systems. Once enabled, you can install using 'yum' package manager tool:
$ yum install youtube-dl
Also, if you wish to add any third party repository, you can still install it right away using curl or wget command:
$ curl https://yt-dl.org/latest/youtube-dl -o /usr/local/bin/youtube-dl
OR
$ wget https://yt-dl.org/downloads/latest/youtube-dl -O /usr/local/bin/youtube-dl
Your system must have curl or wget packages installed to fetch the recent version youtube-dl file. If you don't have them, you may yum to get it.
After fetching the file, you need to set a executable permission on the script to execute properly:
$ chmod a+rx /usr/local/bin/youtube-dl
To Install YouTube-DL in Ubuntu/Linux Mint and Debian:
$ sudo add-apt-repository ppa:nilarimogard/webupd8
$ sudo apt-get update
$ sudo apt-get install youtube-dl
Also, instead using any third party PPA, you can use curl or wget command to install latest version of youtube-dl script:
$ sudo curl https://yt-dl.org/latest/youtube-dl -o /usr/local/bin/youtube-dl
OR
$ sudo wget https://yt-dl.org/downloads/latest/youtube-dl -O /usr/local/bin/youtube-dl
After downloading the script, set the executable permission:
$ sudo chmod a+rx /usr/local/bin/youtube-dl
To Update YouTube-DL,
Youtube-dl itself can be updated to the latest version using the following command:
$ youtube-dl -U
This article covers how to install and use XRDP to securely connect to remote servers. Xrdp is an open-source implementation of the Microsoft Remote Desktop Protocol (RDP) that allows you to control a remote system graphically.
With RDP, you can log in to the remote machine and create a real desktop session the same as if you had logged in to a local machine.
Installing Xrdp on Debian:
Xrdp package is available in the standard Debian repositories. To install it, run:
$ sudo apt install xrdp
The service will automatically start once the installation process is complete. You can verify that the Xrdp service is running by typing:
$ sudo systemctl status xrdp
How to Configure Xrdp on Linux?
The Xrdp configuration files are stored in the /etc/xrdp directory.
Whenever you make any changes to the configuration file you need to restart the Xrdp service:
$ sudo systemctl restart xrdp
This article covers how to view standard log files for troubleshooting any Linux system. Linux system administrators often need to look at log files for troubleshooting purposes.
Linux and the applications that run on it can generate all different types of messages, which are recorded in various log files. Linux uses a set of configuration files, directories, programs, commands and daemons to create, store and recycle these log messages.
Knowing where the system keeps its log files and how to make use of related commands can therefore help save valuable time during troubleshooting.
To view log files on Linux:
Open the Terminal or login as root user using ssh command.
Go to /var/log directory using the following cd command:
# cd /var/log
To list files use the following ls command:
# ls
To Configure Log Files on Ubuntu and CentOS:
This section explains different mechanisms for configuring log files. Let's start with a CentOS example.
To view users currently logged onto a Linux server, enter the who command as a root user:
$ who
This also lists the login history of users.
To view the login history of the system administrator, enter the following command:
$ last reboot
To view information of the last login, enter:
$ lastlog
To Execute Log Rotation on Linux:
Log files that have zeroes appended at the end are rotated files. That means log file names have automatically been changed within the system.
The purpose of log rotation is to compress outdated logs that are taking up space. Log rotation can be done using the logrotate command. This command rotates, compresses, and mails system logs.
logrotate handles systems that create significant amounts of log files. The command is used by the cron scheduler and reads the logrotate configuration file /etc/logrotate.conf. It's also used to read files in the logrotate configuration directory.
This article covers how to set up curl command on your Ubuntu 20.04 LTS machine. curl command is a tool to download or transfer files/data from or to a server using FTP, HTTP, HTTPS, SCP, SFTP, SMB and other supported protocols on Linux or Unix-like system.
To Install cURL for Ubuntu Linux:
1. Update your Ubuntu box, run:
$ sudo apt update && sudo apt upgrade
2. Next, install cURL, execute:
$ sudo apt install curl
3. Verify install of curl on Ubuntu by running:
$ curl --version
This article covers how to use the Sed command on Ubuntu 20.04. Searching and replacing a string of text in a file with the Sed command isn't complicated as you imagine.
sed is a stream editor. It can perform basic text manipulation on files and input streams such as pipelines.
With sed, you can search, find and replace, insert, and delete words and lines.
It supports basic and extended regular expressions that allow you to match complex patterns.
To Find and replace text within a file using sed command:
The procedure to change the text in files under Linux/Unix using sed:
1. Use Stream EDitor (sed) as follows:
$ sed -i 's/old-text/new-text/g' input.txt
2. The s is the substitute command of sed for find and replace
3. It tells sed to find all occurrences of 'old-text' and replace with 'new-text' in a file named input.txt
4. Verify that file has been updated:
more input.txt
This article covers how to install Cockpit on Ubuntu 20.04 system. Cockpit is a free and open source web console tool for Linux administrators and used for day to day administrative and operations tasks.
To Install the Cockpit package on Ubuntu 20.04 LTS Server, run the command:
$ sudo apt update
$ sudo apt install cockpit -y
Once cockpit package is installed successfully then start its service using the following systemctl command,
$ sudo systemctl start cockpit
Run the following to verify the status of cockpit service,
$ sudo systemctl status cockpit
Features of Cockpit:
Cockpit allows you to perform:
1. Service Management – Start, stop, restart, reload, disable, enable, mask e.t.c
2. User Account Management – Add users, delete, Lock, assign Administrator role, set password, force password change, Add Public SSH keys e.t.c.
3. Firewall Management
4. Cockpit Container management
5. SELinux Policy management
6. Journal v2
7. iSCSI Initiator configurations
8. SOS-reporting
9. NFS Client setup
10. Configure OpenConnect VPN Server
11. Privileged Actions – Shutdown, Restart system
12. Join Machine to Domain
13. Hardware Device Management
14. System Updates for dnf, yum, apt hosts
15. Manage the Kubernetes Node