<![CDATA[It's FOSS]]>https://itsfoss.com/https://itsfoss.com/favicon.pngIt's FOSShttps://itsfoss.com/Ghost 5.53Thu, 13 Jul 2023 07:49:22 GMT60<![CDATA[FOSS Weekly #23.28: China's Linux OS, Linux Exit Codes, Btrfs Origins and More]]>https://itsfoss.com/newsletter/foss-weekly-23-28/64ab89c543d7550c8ddc6b05Thu, 13 Jul 2023 04:37:19 GMT

I have a feeling that we've been covering more commands and terminal-based tutorials than desktop-focused tutorials.

Do you also think the same? If yes, let me know so that we can put the focus back where you, our readers, want it.

💬 Let's see what you get in this edition of FOSS Weekly:

  • SUSE plans to fork Red Hat
  • Get familiar with exit codes in Linux
  • Continuation learning with Bash Basics series and Linux command examples
  • Birthday wishes in ASCII format
  • And other Linux news, videos, Puzzles and, of course, memes!

📰 Linux news

Thunderbird 115 was released, featuring the long-awaited redesign.

Thunderbird Reborn! Much Awaited Thunderbird 115 ‘Supernova’ is Here With Stunning Makeover
Thunderbird’s much-anticipated redesign is finally here! Let’s take a look.
FOSS Weekly #23.28: China's Linux OS, Linux Exit Codes, Btrfs Origins and More

🧠 What we’re thinking about

Here's a detailed brief history of the btrfs file system that I came across recently although the article is more than a decade old.

A short history of btrfs
You probably have heard of the cool new kid on the file system block,btrfs (pronounced“butter-eff-ess”) - after all, Linus Torvalds is using it as his rootfile system on one of his laptops. But you might not know muchabout it beyond a few high-level keywords - copy-on-write, checksums,writabl…
FOSS Weekly #23.28: China's Linux OS, Linux Exit Codes, Btrfs Origins and More

🧮 Tutorials

Let's a-raise your bash skills with arrays.

Bash Basics Series #5: Using Arrays in Bash
Time to use arrays in bash shell scripts in this chapter. Learn to add elements, delete them and get array length.
FOSS Weekly #23.28: China's Linux OS, Linux Exit Codes, Btrfs Origins and More

Unravel the mystery behind exit codes in Linux.

Exit Codes in Linux [Explained]
Unraveling the mystery of exit codes in Linux. Learn what are the exit codes and why and how they are used.
FOSS Weekly #23.28: China's Linux OS, Linux Exit Codes, Btrfs Origins and More

Continue exploring essential Linux commands.

Using cp Command in Linux
get familiar with the cp command for copying files and directories in the Linux command line.
FOSS Weekly #23.28: China's Linux OS, Linux Exit Codes, Btrfs Origins and More

Learn to create an animated ASCII birthday animation in the Linux terminal! 🎂

Display Animated ASCII Birthday Wish in Linux Terminal 🎂
Make the special occasion for your loved ones even more special by creating an ASCII birthday animation in the Linux terminal.
FOSS Weekly #23.28: China's Linux OS, Linux Exit Codes, Btrfs Origins and More

📹 What we are watching

One of our followers on Mastodon shared an interesting take on what to do if your favorite free software is on the brink of being shut down.


✨ Project highlights

openKylin can be a game-changer for the Linux ecosystem in China.

Exploring openKylin: China’s 1st Independent Open-Source Linux OS
A new Linux distribution was built from scratch. What’s exciting about it? Let us take a peek at it.
FOSS Weekly #23.28: China's Linux OS, Linux Exit Codes, Btrfs Origins and More

🧩 Puzzle (for Pro members only)

There are five Wordle. They can be software programs, desktops, distributions etc. Try to complete it in as fewer steps as possible.

Puzzle of The Week: Wordle #01
Exercise those ‘little gray cells’ of yours and solve this puzzle.
FOSS Weekly #23.28: China's Linux OS, Linux Exit Codes, Btrfs Origins and More

🛍️ Interesting deal for you

Featuring a mix of beginner-level and masterclasses, this comprehensive video course curriculum will help you get a handle on using Python for AI and machine learning applications, data analytics, and more.

Your purchase supports Children’s Miracle Network.

The Complete Python Mega Bundle
Pay what you want for awesome Python courses and support charity!
FOSS Weekly #23.28: China's Linux OS, Linux Exit Codes, Btrfs Origins and More

💡 Quick handy tip

If you are bothered by the title-bar taking extra space in Firefox, you can easily hide it. Right-click on the tab bar and choose Customize Toolbar.

Firefox opens the customization menu in a new tab. Move to this new Customize tab and look at the bottom. You’ll see Title Bar option checked.

You just need to uncheck this Title Bar option. That’s it.

FOSS Weekly #23.28: China's Linux OS, Linux Exit Codes, Btrfs Origins and More

🤣 Meme of the week

Once you enter Vim, it's either all or nothing!

FOSS Weekly #23.28: China's Linux OS, Linux Exit Codes, Btrfs Origins and More

🗓️ Tech Trivia

On July 9, 1981, Nintendo released the hit video game Donkey Kong in Japan. The game features the first-ever appearance of the Mario character. The game was launched in the USA a few weeks later.


🧑‍🤝‍🧑 FOSSverse corner

Recently, a reader noticed that CopyQ clipboard application was not working as intended in Ubuntu 23.04. I shared the possible fix for the problem in the Community.

CopyQ Not Saving Clipboard Copy Paste in Ubuntu 23.04
I have used copyq for a while now, and have been pleased with its performance. It seems to have stopped working. I am using UBUNTU 23.04. I have tried reinstalling it, but to no avail. Anyone got any thoughts?
FOSS Weekly #23.28: China's Linux OS, Linux Exit Codes, Btrfs Origins and More

Don't forget to join the Community :)


❤️ Loving FOSS Weekly?

Share it with you Linux-using friends and encourage them to subscribe (hint: it's here).

Become a Pro member and help us survive the onslaught of AI 🙏

Anything else? Hit the reply button.

Keep reading It's FOSS :)

]]>
<![CDATA[Using cp Command in Linux]]>https://itsfoss.com/cp-command/64ad351043d7550c8ddc7181Tue, 11 Jul 2023 12:51:10 GMT

The cp command is one of the essential Linux commands you probably will be using on a regular basis.

As the name indicates, cp stands for copy and it is used for copying files and directories in Linux command line.

It's one of the simpler commands with only a few options but that doesn't mean you cannot know more about it.

Before you see some practical examples of the cp command, I advise getting familiar with the concept of absolute and relative paths because you'll need to use them while copying files from one place to another.

Absolute vs Relative Path in Linux: What’s the Difference?
In this essential Linux learning chapter, know about the relative and absolute paths in Linux. What’s the difference between them and which one should you use.
Using cp Command in Linux

Copy a file

The simplest and most common use of the cp command is for copying files. For that, you just have to specify the source file and the destination where you want to 'paste' the file.

cp source_file destination_directory
Using cp Command in Linux
Copy a file

Rename the file while copying it

You can also rename the file while copying it to another location. This is like those 'save as' options you see in text editors.

For this, you must mention the new file name along with the path.

cp source_file destination_directory/new_filename
Using cp Command in Linux
Rename the file while copying

Copy multiple files

You can also copy multiple files to another location.

cp file1 file2 file3 destination_directory
Using cp Command in Linux
Copy multiple files

You cannot rename files in this case.

Of course, you can use wildcard expansion and copy files of a certain type to another location:

cp *.txt destination_directory
Using cp Command in Linux
Copy multiple files with Wildcard expansion

Avoid overwriting while copying files

If you are copying file1.txt to a directory where there already exists a file named file1.txt, it will be overwritten with the file you are copying.

You may not always want that. This is why the cp command provides several options to deal with overwriting.

The firstmost is the interactive mode with the option -i. In the interactive mode, it will ask you to confirm or deny the overwriting of the destination file.

cp -i source_file destination_directory
cp: overwrite 'destination_directory/source_file'?

Press Y to overwrite and N to skip copying the file.

Using cp Command in Linux
Overwrite, but ask interactively (content overwritten)
Using cp Command in Linux
Overwrite, but ask interactively (content is NOT overwritten)

The option -n negates overwriting completely. Destination files won't be overwritten with this option.

cp -n source_file destination_directory
Using cp Command in Linux
Negated Overwriting (content inside has not changed)

There is also an option -b for automatically creating a backup if the destination file is going to be overwritten. B stands for backup, I presume.

cp -b source_file destination_directory
Using cp Command in Linux
Overwriting a file, but with a backup

And lastly, there is the 'update' option -u which will overwrite the destination file if it is older than the source file or if it destination file does not exist.

cp -u source_file destination_directory
Using cp Command in Linux
The newer file is overwritten into the older

Copy directories (folders)

The cp command is also used for copy directories in the Linux command line.

You need to use the recursive option -r for copying directories.

cp -r source_dir destination_dir
Using cp Command in Linux

You can also copy multiple directories to another location:

cp -r dir1 dir2 dir3 target_directory
Using cp Command in Linux

Preserve attributes while copying

When you copy a file to another location, its timestamp, file permission and even ownership gets changed.

That's the normal behavior. But in some cases, you may want to preserve the original attribute even when you are copying the file.

To preserve the attributes, use the option -p:

cp -p source_file destination_directory
Using cp Command in Linux
💡

There is also -a option for archive mode. It will preserve even the ACLs.

🏋️ Exercise time

Want to practice the cp command a little? Here are some simple exercises for you.

  • Open a terminal and create a directory named practice_cp
  • Now, copy the /etc/services file in this newly created directory.
  • Make some minor changes to the copied services file in practice directory.
  • Now, copy /etc/services file again but in update mode. Does it change anything? Observe.
  • Look into /var/log directory and copy the log files that start with mail into your practice directory
  • Now, go back to your home directory and create a new directory named new_dir (well, I couldn't think of any better)
  • Copy the practice_cp directory to new_dir

That should be good enough exercise for you. Enjoy learning Linux commands with It's FOSS.

]]>
<![CDATA[Bash Basics Series #5: Using Arrays in Bash]]>https://itsfoss.com/bash-arrays/64abac5a43d7550c8ddc6b75Mon, 10 Jul 2023 12:05:56 GMT

In the earlier part of the series, you learned about variables. The variables can have a single value in it.

Arrays can have several values inside it. This makes things easier when you have to deal with several variables at a time. You don't have to store individual values in a new variable.

So, instead of declaring five variables like this:

distro1=Ubuntu
distro2=Fedora
distro3=SUSE
distro4=Arch Linux
distro5=Nix

You can initialize all of them in a single array:

distros=(Ubuntu Fedora SUSE "Arch Linux" Nix)

Unlike some other programming languages, you don't use commas as array element separators.

That's good. Let's see how to access the array elements.

Accessing array elements in bash

The array elements are accessed using the index (position in the array). To access array element at index N, use:

${array_name[N]}
💡

Like most other programming languages, the array starts at index 0 in Bash shell. This means the first element has index 0, the second element has index 1 and the nth element has index n-1.

So, if you want to print the SUSE, you'll use:

echo ${distros[2]}
Bash Basics Series #5: Using Arrays in Bash
🚧

There must not be any white space after ${ or before }. You CANNOT use it like ${ array[n] }.

Access all array elements at once

Let's say you want to print all the elements of an array.

You may use echo ${array[n]} one by one but that's really not necessary. There is a better and easier way:

${array[*]}

That will give you all the array elements.

Bash Basics Series #5: Using Arrays in Bash

Get array length in bash

How do you know how many elements are there in an array? There is a dedicated way to get array length in Bash:

${#array_name[@]}

That's so simple, right?

Bash Basics Series #5: Using Arrays in Bash

Add array elements in bash

If you have to add additional elements to an array, use the += operator to append element to existing array in bash:

array_name+=("new_value")

Here's an example:

Bash Basics Series #5: Using Arrays in Bash
🚧

It is important to use () while appending an element.

You can also use the index to set the element at any position.

array_name[N]=new_value

But remember to use the correct index number. If you use it on an existing index, the new value will replace the element.

If you use an 'out of bound' index, it will still be added after the last element. For example, if the array length is six and you try to set a new value at index 9, it will still be added as the last element at the 7th position (index 6).

Bash Basics Series #5: Using Arrays in Bash

Delete an array element

You can use unset shell built-in to remove an array element by providing the index number:

unset array_name[N]

Here's an example, where I delete the 4th element of the array.

Bash Basics Series #5: Using Arrays in Bash

You can also delete the entire array with unset:

unset array_name
💡

There are no strict data type rules in Bash. You can create an array that contains integers and strings both.

🏋️ Exercise time

Let's practice what you learned about bash arrays.

Exercise 1: Create a bash script that has an array of five best Linux distros. Print them all.

Now, replace the middle choice with Hannah Montanna Linux.

Exercise 2: Create a bash script that accepts three numbers from the user and then prints them in reverse order.

Expected output:

Enter three numbers and press enter
12 23 44
Numbers in reverse order are: 44 23 12

I hope you are enjoying learning bash shell scripting with this series. In the next chapter, you'll learn about using if-else. Stay tuned.

]]>
<![CDATA[What are Exit Codes in Linux?]]>https://itsfoss.com/linux-exit-codes/6497ed0e95223604faf999c9Sun, 09 Jul 2023 07:05:25 GMT

An exit code or exit status tells us about the status of the last executed command. Whether the command was completed successfully or ended with an error. This is obtained after the command terminates.

The basic ideology is that programs return the exit code 0 to indicate that it executed successfully without issues. Code 1 or anything other than 0 is considered unsuccessful.

There are many more exit codes other than 0 and 1, which I'll cover in this article.

Various exit codes in Linux shell

Let us take a quick look at the prominent exit codes in the Linux shell:

Exit code Meaning of the code
0 Command executed with no errors
1 Code for generic errors
2 Incorrect command (or argument) usage
126 Permission denied (or) unable to execute
127 Command not found, or PATH error
128+n Command terminated externally by passing signals, or it encountered a fatal error
130 Termination by Ctrl+C or SIGINT (termination code 2 or keyboard interrupt)
143 Termination by SIGTERM (default termination)
255/* Exit code exceeded the range 0-255, hence wrapped up
📋

The termination signals like 130 (SIGINT or ^C) and 143 (SIGTERM) are prominent, which are just 128+n signals with n standing for the termination code.

Now that you are briefly familiar with the exit codes let's see about their usage.

Retrieving the exit code

The exit code of the previously executed command is stored in the special variable $?. You can retrieve the exit status by running:

echo $?

This will be used in all our demonstrations to retrieve the exit code.

Note that the exit command supports carrying the same exit code of the previous command executed.

Exit code 0

Exit code 0 means that the command is executed without errors. This is ideally the best case for the completion of commands.

For example, let us run a basic command like this

neofetch 

echo $?
What are Exit Codes in Linux?
Exit code 0 (successful execution)

This exit code 0 means that the particular command was executed successfully, nothing more or less. Let us demonstrate some more examples.

You may try killing a process; it will also return the code 0.

pkill lxappearance
What are Exit Codes in Linux?
Killing an application (same shell) results in code 0

Viewing a file's contents will also return an exit code 0, which implies only that the 'cat' command executed successfully.

Exit code 1

Exit code 1 is also a common one. It generally means the command terminated with a generic error.

For example, using the package manager without sudo permissions results in code 1. In Arch Linux, if I try this:

pacman -Sy 

It will give me exist code as 1 meaning the last command resulted in error.

What are Exit Codes in Linux?
Exit status 1 (impermissible operation)
📋

If you try this in Ubuntu-based distros (apt update without sudo), you get 100 as an error code for running 'apt' without permissions. This is not a standardized error code, but one specific to apt.

While this is a general understanding, we can also interpret this as "operation impermissible".

Operations like dividing by zero also result in code 1.

What are Exit Codes in Linux?
Division by zero

Exit code 2

This exit code is given out when the command executed has a syntax error. Misusing the arguments of commands also results in this error.

It generally suggests that the command could not execute due to incorrect usage.

For example, I added two hyphens to an option that's supposed to have one hyphen. Code 2 was given out.

grep --z file.txt
What are Exit Codes in Linux?
Invalid argument results in code 2

When permission is denied, like accessing the /root folder, you get error code 2.

What are Exit Codes in Linux?
Permission denied

Exit code 126

126 is a peculiar exit code since it is used to indicate a command or script was not executed due to a permission error.

This error can be found when you try executing a shell script without giving execution permissions.

What are Exit Codes in Linux?
Exit code 126 due to insufficient permissions

Note that this exit code appears only for the 'execution' of scripts/commands without sufficient permissions, which is different from a generic Permission Denied error.

So, on't confuse it with the previous example you saw with exit code 2. There, ls command ran and the permission issue came with the directory it was trying to execute. Here, the permission issues came from the script itself.

Exit code 127

This is another common one. Exit code 127 refers to "command not found". It usually occurs when there's a typo in the command executed or the required executable is not in the $PATH variable.

For example, I often see this error when I try executing a script without its path.

What are Exit Codes in Linux?
Script executed without the path gives "command not found"

Or when the executable file you're trying to run, is not listed in the $PATH variable. You can rectify this by adding the parent directory to the PATH variable.

How to Add a Directory to PATH in Linux
Learn all the essential steps about adding a directory to the PATH in Linux and making those changes permanently.
What are Exit Codes in Linux?

You'll also get this exit code when you type commands that do not exist.

What are Exit Codes in Linux?
Unmount is not a command, and Screenfetch is not installed

Exit code series 128+n

When an application or command is terminated or its execution fails due to a fatal error, the adjacent code to 128 is produced (128+n), where n is the signal number.

This includes all types of termination codes, like SIGTERM, SIGKILL, etc that apply to the value 'n' here.

Code 130 or SIGINT

SIGINT or Signal for Keyboard Interrupt is induced by interrupting the process by termination signal 2, or by Ctrl+C.

Since the termination signal is 2, we get a code 130 (128+2). Here's a video demonstrating the interrupt signal for lxappearance.

0:00
/0:31

SIGINT(2) termination or Keyboard Interrupt (^C) that gives code 130

Code 137 or SIGKILL

The SIGKILL termination signal that kills the process instantly has a termination signal 9. This is the last method one should use while terminating an application.

The exit code thrown is 137 since the termination signal is 9 (128+9).

0:00
/0:19

SIGKILL(9) termination that gives code 137

Code 143 or SIGTERM

SIGTERM or Signal to Terminate is the default behavior when a process is killed without specifying arguments.

The termination code for SIGTERM is 15, hence this signal gets an exit code of 143 (128+15).

0:00
/0:29

SIGTERM(15) termination that gives code 143

There are other termination signals that you may not have known before; they too have their own exit codes similar to these. You can check them out here:

How to use SIGINT and other Termination Signals in Linux
Terminating executing process is more than just kill -9. Here are some of the prominent termination signals and their usage.
What are Exit Codes in Linux?
📋

Note that these signals may not appear if terminated from the same session from which the process was started. If you're reproducing these, terminate from a different shell.

On a personal note, signal 128 was impossible to reproduce.

What if the code exceeds 255?

Recent versions of Bash retain the original exit code value even beyond 255, but generally, if the code exceeds 255, then it is wrapped up.

That is, code 256 becomes '0', 257 becomes '1', 383 becomes '127', and so on and so forth. To ensure better compatibility, keep the exit codes between 0 and 255.

Wrapping up

I hope you learned something about the exit codes in the Linux shell. Using them can come in handy for troubleshooting various issues.

If you are using these codes in a shell script, make sure you understand the meaning of each code in order to make it easier for troubleshooting.

In case you need a reference, check out the Bash series here:

Bash Basics #1: Create and Run Your First Bash Shell Script
Start learning bash scripting with this new series. Create and run your first bash shell script in the first chapter.
What are Exit Codes in Linux?

That's all about the article. Feel free to let me know in the comments section if I have missed anything.

]]>
<![CDATA[FOSS Weekly #23.27: Peppermint OS, Warp Terminal, Math Bash and More]]>https://itsfoss.com/newsletter/foss-weekly-23-27/64a3d40a1a6c8648cfd4218fThu, 06 Jul 2023 04:29:29 GMT

Achievement unlocked 🔥🥳 🎊

It's FOSS crossed 100K followers on Twitter. That's good news.

What's better is that we crossed 10K followers on Mastodon, the open source, decentralized Twitter alternative.

Now, that's the real achievement.

💬 Let's see what you get in this edition of FOSS Weekly:

  • Continuation of our Bash Basics series
  • A post-quantum-secure cloud storage solution is in the works by Tutanota
  • And other Linux news, videos, and, of course, memes!

📰 Linux news


🧠 What we’re thinking about

Yeah... still cannot get over Red Hat's decision. Here's an opinion piece on why it's a bad move in the long run. It got quite a buzz in the last few days.

The Suicide Attempt by Red Hat [Opinion]
The latest decision to put Red Hat’s source code behind a paywall may hurt its direct competitors today but it will negatively impact Red Hat tomorrow.
FOSS Weekly #23.27: Peppermint OS, Warp Terminal, Math Bash and More

🧮 Tutorials

In the fourth chapter of our Bash Basics series, learn to do basic mathematics in Bash.

Bash Basics Series #4: Arithmetic Operations
In the fourth chapter of the series, learn to use basic mathematics in Bash.
FOSS Weekly #23.27: Peppermint OS, Warp Terminal, Math Bash and More

'ls' is the most used command in Linux; learn how to use it efficiently.

Using ls Command in Linux
ls is one of the simplest and most frequently used commands is Linux. Learn to use it effectively in this tutorial.
FOSS Weekly #23.27: Peppermint OS, Warp Terminal, Math Bash and More

Remove unwanted software repositories from Ubuntu by following our guide.

Remove Software Repositories from Ubuntu [3 Easy Ways] 😎
From apt-add-repository to Software & Updates tool, here are several ways to remove software repositories from Ubuntu.
FOSS Weekly #23.27: Peppermint OS, Warp Terminal, Math Bash and More

📹 What we are watching

If you like video podcasts, here's a good episode from The Linux Cast for Debian fans.


✨ Project highlights

Here's a nice little generator for Bash prompts.

Bash Prompt Generator
Create a custom PS1 variable for your Bash
FOSS Weekly #23.27: Peppermint OS, Warp Terminal, Math Bash and More

A new terminal written in Rust and coupled with AI? But it needs to create account for using cloud features. I am not a fan of such approach.

GitHub - warpdotdev/Warp: Warp is a blazingly-fast modern Rust based GPU-accelerated terminal built to make you and your team more productive.
Warp is a blazingly-fast modern Rust based GPU-accelerated terminal built to make you and your team more productive. - GitHub - warpdotdev/Warp: Warp is a blazingly-fast modern Rust based GPU-accel…
FOSS Weekly #23.27: Peppermint OS, Warp Terminal, Math Bash and More

🧩 Puzzle (for Pro members only)

Guess various file managers in the Linux desktop ecosystems in this puzzle.

Puzzle of The Week: Acrostic #02: File Managers
Exercise those ‘little gray cells’ of yours and solve this puzzle.
FOSS Weekly #23.27: Peppermint OS, Warp Terminal, Math Bash and More

🛍️ Interesting deal for you

Featuring a mix of beginner-level and masterclasses, this comprehensive video course curriculum will help you get a handle on using Python for AI and machine learning applications, data analytics, and more.

Your purchase supports Children’s Miracle Network.

The Complete Python Mega Bundle
Pay what you want for awesome Python courses and support charity!
FOSS Weekly #23.27: Peppermint OS, Warp Terminal, Math Bash and More

💡 Quick handy tip

In GNOME's Nautilus file manager, you can drop a folder into the terminal and it converts to its absolute path.

For example, cd <drag and drop a folder> will enter to the directory.

Even better use is with the files. Let's say you have a deb file to install.

You type part of it and drop it like this: sudo apt install <drag the deb file>

It will give you the absolute path of the deb file.

FOSS Weekly #23.27: Peppermint OS, Warp Terminal, Math Bash and More

Give it a try.


🤣 Meme of the week

Do you agree?

FOSS Weekly #23.27: Peppermint OS, Warp Terminal, Math Bash and More

🗓️ Tech Trivia

On July 4, 1956, MIT's Whirlwind became the first ever computer to allow user interaction through a keyboard. Before that, user inputs were provided through dials, switches and punch cards.


🧑‍🤝‍🧑 FOSSverse corner

An interesting thread by two of our dedicated community members, Neville and Rosika on the inner workings of the 'virt-manager package' which uses qemu/KVM to run virtual machines inside a host Linux system.

Communication between host and guest VM when using virt-manager
This is a joint post by @nevj and @Rosika and It reports on our collaborative investigations into the virt-manager package which uses qemu/KVM to run virtual machines inside a host Linux system. In particular we have looked at various ways of communicating between a guest Linux system running i…
FOSS Weekly #23.27: Peppermint OS, Warp Terminal, Math Bash and More

Come and share your thoughts, too!


❤️ Enjoying FOSS Weekly?

Forward it to Linux-using friends and encourage them to subscribe (hint: it's here).

Become a Pro member and show your support 🙏

Something else? Share it with me by pressing the reply button.

Don't stop loving It's FOSS :)

]]>
<![CDATA[Display Animated ASCII Birthday Wish in Linux Terminal 🎂]]>https://itsfoss.com/birthday-wish-linux-terminal/64a275201a6c8648cfd41c11Wed, 05 Jul 2023 05:35:06 GMT

Birthdays are special occasions, and it’s very satisfying and a pleasure to get birthday wishes from loved ones.

As a Linux user, you can surprise our friends and family with some cool birthday wishes from the terminal.

Here's a birthday card (or should I say animation) I created for the birthday of Abhishek Sir.

0:00
/0:15

Everyone in the team liked it so much that I was requested to do a tutorial on it. I am only glad to comply as it may help our readers :)

This tutorial requires editing config files in the terminal. Proficiency with Linux terminals and commands make it easier to follow this tutorial.

Install PyBirthdayWish

PyBirthdayWish is a small Python program through which you can create beautiful terminal birthday wishes. With music too!

The program itself is not available in the default repositories of Ubuntu. You need to install it using Pip.

First, install pip in Ubuntu, using the command below:

sudo apt install python3-pip

Once Pip is installed, you can clone the repo and install the program:

git clone https://github.com/hemantapkh/PyBirthdayWish.git && cd PyBirthdayWish && pip install -r requirements.txt

On their repo, you can check the .requirements.txt file to know what are the requirements as mentioned in the above command.

After the installation is complete, inside the PyBirthdayWish directory, that you have cloned, run the command below:

python3 PyBirthdayWish.py

This will ask you to press F11 and then enter to go full screen mode and then play the animation.

There is music too, but not shown here.

It's highly customizable. Let me show various levels of optional customization you can do with this tool.

Create the default birthday wish

In the above program, there are three wish Python files that can be used for the animation. They are, example (default), art and artwithstars. You can open these three files in text editor to get an overview.

Display Animated ASCII Birthday Wish in Linux Terminal 🎂
Default art files

Now, if you want to use the artwithstars file instead of the default example, open the config.py in any available text editor, replace the arts entry with the required name and save it, as shown in the screenshot below:

Display Animated ASCII Birthday Wish in Linux Terminal 🎂
Change the design file

After that, in the PyBirthdayWish directory, run:

python3 PyBirthdayWish.py

And you will get the new animation.

Create a custom birthday wish

What if you want to print the name of your loved one, instead of the default text? This needs a little bit of patience because you need to edit the art file without destroying it.

First, make a backup copy of the design art files you want. Which is basically copying the file in the same arts directory but with a different name; say friend.py.

Now, open the design art file with the text editor of your choice. Replace the text in the art file with the one you need. It will be wise to use the symbols | _ \ / for creating the text, design etc. You can use an online tool to convert text to ASCII.

Display Animated ASCII Birthday Wish in Linux Terminal 🎂
New text "Friend" added as a new file
💡

Typing one character moves the rest of the animation one character forward. Similarly, removing a character moves the rest of the design, one character backward. So, you should add a space if you remove a character. Similarly, remove one space if you added a new character on a particular line. This should be done in real-time so that you can view the changes. This way, you can match the rest of the design and not destroy the looks, when completed.

After completing the edit, save it. Now, open config.py and change the art file to show your file.

Display Animated ASCII Birthday Wish in Linux Terminal 🎂
Change the config file to highlight the new file

You can now run to get your required text inside the animation:

python3 PyBirthdayWish.py

Use your own music file

You can use your own music file as part of this animation.

🚧

If you are planning to upload the video on YouTube of other such sites, please use copyright-free music to avoid issues.

Copy your music file inside the cloned directory.

Display Animated ASCII Birthday Wish in Linux Terminal 🎂
Custom music file is copied inside the directory

Edit the config.py file to add the new music, as shown in the screenshot below:

Display Animated ASCII Birthday Wish in Linux Terminal 🎂
Custom music file added to config file

Done! Now, if you execute the run command, python3 PyBirthdayWish.py, the custom music will be played along with the animation.

Display Animated ASCII Birthday Wish in Linux Terminal 🎂

New Book: Efficient Linux at the Command Line

Pretty amazing Linux book with lots of practical tips. It fills in the gap, even for experienced Linux users. Must have in your collection.

Get it from Amazon

Create an executable

If you want to send the above wish message as an executable to a friend, there is a way for this too.

An associated pyinstaller will be installed to the .local/bin directory, which will not be on your path.

So add that directory to your path using:

export PATH=$PATH:/home/team/.local/bin

To make it permanent, add it to your ~/.bashrc file.

After you are done with the art file editing and changing the config file to reflect the change, use the command below to create an executable:

pyinstaller --noconfirm --onefile --console --icon "icon.ico" --no-embed-manifest --add-data "arts:arts/"  --add-data "config.py:." --add-data "HappyBirthday.mp3:." --add-data "PyBirthdayWish.py:."  "PyBirthdayWish.py"

It will create an executable file named “PyBirthdayWish” to the PyBirthdayWish/dist directory.

Display Animated ASCII Birthday Wish in Linux Terminal 🎂
Executable file location

Copy this executable and send to anybody who want to view this. They can execute it with:

./PyBirthdayWish
🚧

Always be cautious while running executables from unknown external sources.

More terminal fun

Like Birthdays, Christmas too is a special occasion. You can give some festive touch to your Linux desktop if you want.

Celebrate Christmas in Linux Way: Give Your Linux System a Christmas Touch
It’s the holiday season and many of you might be celebrating Christmas already. From the team of It’s FOSS, I would like to wish you a Merry Christmas and a happy new year. To continue the festive mood, I’ll show you some really awesome Linux wallpapers on
Display Animated ASCII Birthday Wish in Linux Terminal 🎂

If you liked ASCII animation, you may like ASCII art, too.

Convert Images to ASCII Art in Linux Terminal
Want some fun in the Linux terminal? How about converting a regular image into ASCII art? This tool lets you convert any image into ASCII art.
Display Animated ASCII Birthday Wish in Linux Terminal 🎂

And why just stop here? Explore more ASCII tools.

10 Tools to Generate and Have Fun With ASCII Art in Linux Terminal
Linux terminal is not as scary as you think. Of course, it could be intimidating in the beginning but once you know the terminal better, you start loving it. You are likely to use the terminal for serious work. But there are many fun stuff you can do in the
Display Animated ASCII Birthday Wish in Linux Terminal 🎂

Enjoy using Linux in this fun way :)

🗨 Let me know if you face any issues with this tool and I'll try to help in my capacity.

]]>
<![CDATA[Using ls Command in Linux]]>https://itsfoss.com/ls-command/64a2508a1a6c8648cfd41b8fTue, 04 Jul 2023 06:11:00 GMT

In my opinion, the ls command is the most used Linux command as it is often used to verify the outcome of the previous operation by listing the directory contents.

The ls command stands for a list; all it does is list the contents of the specified directory.

In this tutorial, I'll walk you through multiple examples of using the ls command.

I will also share some practice questions to test the learnings.

How to use the ls command

To use the ls command, you'd have to follow the simple command syntax:

ls [OPTIONS] Targeted_Directory

Here,

  • [OPTIONS]: It is used to tweak the default behavior of the ls command.
  • Targeted_Directory: This is where you provide the directory name or the absolute path to the directory.

You might wonder what happens when you use the ls command without any options. And to answer that, I used the ls command in my current working directory:

ls 
Using ls Command in Linux

As you can see, it listed all the directories and files available in the current working directory. But you can do a lot more than just getting the names and files present in the current working directory.

Let me show you how.

1. List files and directories with ownership

One of the primary use of the ls command to find the permissions and ownership of a particular file or a directory.

For that you'd have to use the -l option (also called long listing) with the ls command:

ls -l

Once you do that, you can expect similar output:

sagar@itsFOSS:~$ ls -lh
-rwxrw-r-- 1 sagar sagar 666M Dec 10 18:16 Fedora.iso

Notice how I used an addition -h option? I'll discuss it in the next section.

For now, if the output looks too complicated, then let me simplify things for you:

Using ls Command in Linux

As you can see, each text block has its own meaning such as the permissions for owner, group, and others.

If you want to dive deep into file permissions, I would recommend our detailed guide on file permissions in Linux:

Linux File Permissions and Ownership Explained with Examples
Linux file permissions explained in simpler terms. Also learn how to change the file permissions and ownership in Linux in this detailed beginner’s guide.
Using ls Command in Linux

2. Get information in a human-readable format

By default, the file size is shown in bytes which is not the best way to know your file size. So how do you get the same info but in human-readable form?

Simple. You use the -h option with the ls command:

ls -l -h

And here's the comparison between the default and the human-readable form:

Using ls Command in Linux
Comparison between the default and the human-readable form (Click to expand)

Much better. Isn't it?

💡

The ls command is good to see the file sizes. However, it won't give you the directory size which is almost always displayed as 4K. To get directory size, use the du command.

3. List hidden files

Like any other file manager, the ls command won't list the hidden files (I mean they are supposed to be hidden. Right?).

But what if you want to list the hidden files along with the regular files? To do so, you can use the -a option:

ls -a

As you can see, the filename starting with a dot . are hidden files.

Using ls Command in Linux
Click to expand
💡

You may also use ls -A which works almost the same as ls -a except it won't include the . and .. directories.

4. List files recursively

There are multiple ways to list files recursively and using the ls command is one of them.

In case you don't know, listing files recursively means listing files of all the sub-directories present until the last element of every sub-directory is shown.

And to list files recursively, you can use the -R flag as shown:

ls -R
Using ls Command in Linux

In a way, it gives you the current directory structure. Personally, I prefer the for this purpose but you'll have to install it first.

💡

You don't have to be in the directory to list its content. You can also list directory contents by providing its absolute or relative path like this: ls /var/log

5. Differentiate between files and directories while using ls

While the different colors for files and directories should do the job. But due to some reason, if you want to symbolize files and directories here you have it.

In the ls command, you have a -F flag that adds a forward slash / to every directory name:

ls -F
Using ls Command in Linux

6. List only files with certain file extensions

There are times when you only want to list files with specific file extensions and trust me this is the easiest of all.

To do that, you don't have to use any options. Just append the file extension to the Asterisk * such as *.png, *.txt, etc:

ls *.extension

For example, if I only want to list the ISO files, then, I will be using the following command:

ls *.iso
Using ls Command in Linux

7. Sort output based on size

To sort the output based on the file size, you'd have to use the -S flag and it will list files from largest to the smallest manner (descending):

ls -lhS
Using ls Command in Linux

Similarly, if you want to reverse this order to list the smallest files first, you can use the -r flag to reverse the order:

ls -lhSr
Using ls Command in Linux

8. Sort files based on date and time

The ls commands includes the modified time in its listing.

To list the newest files first, you can use the -t flag as shown:

ls -lht
Using ls Command in Linux

You can use the -r flag as I explained previously to reverse the order here too.

ls -lrt

This will give you the latest modified files at the bottom of the display. This is particularly helpful if you have too many files in the directory and want to see which files were modified recently. I used this while troubleshooting my software project.

Using ls Command in Linux

Let's summarize what you've learned so far!

Here, I will share a table with multiple options that were used with the ls command in this tutorial:

Command Description
ls -l Long list of files and directories
ls -lh Prints information in human-readable form
ls -a Include hidden files in listing
ls -R List files recursively
ls -F Add a forward slash to the directory name
ls *.ext List files having specific extensions
ls -lS Sort files based on file size
ls -lt Sort files based on time
-r Reverse the sorting (combined with S or t)

🏋️And practice your learning

Practicing what you've learned is always a good idea, which is why we try to add a practice section in each terminal guide.

So here are some simple practice exercise of the ls command:

  • List the contents of the /var/log
  • Save the command output in a file named output.txt
  • Identify the 3 most recent files (Use time based sorting)
  • Display the files based on their size but in reverse order
  • Check if there are any hidden files

That would be good practice for you. Stay tuned for more Linux command learning.

And if you are new to the terminal, don't forget to follow our Terminal Basics series

Linux Command Tutorials for Absolute Beginners
Never used Linux commands before? No worries. This tutorial series is for absolute beginners to the Linux terminal.
Using ls Command in Linux

Enjoy :)

]]>
<![CDATA[Bash Basics Series #4: Arithmetic Operations]]>https://itsfoss.com/bash-arithmetic-operation/64a2616c1a6c8648cfd41bb9Mon, 03 Jul 2023 10:43:51 GMT

You can do a lot of things with bash scripts. Performing simple arithmetic operations with the variables is one of them.

The syntax for arithmetic operations in the bash shell is this:

$((arithmetic_operation))

Let's say you have to calculate the sum of two variables. You do it like this:

sum=$(($num1 + $num2))

There is no restriction on the use of white space inside the (()). You can use $(( $num1+ $num2)), $(( $num1+ $num2 )) or $(( $num1+ $num2 )). It all will work the same.

Before I discuss it in detail with examples, let me share the arithmetic operators it supports.

Basic arithmetic operators in Bash

Here's a list of the arithmetic operators in the Bash shell.

Operator Description
+ Addition
- Subtraction
* Multiplication
/ Integer division (without decimal)
% Modulus division (only remainder)
** Exponentiation (a to the power b)
🚧

Bash does not support floating points (decimals). You'll have to use other commands like bc to deal with them.

Addition and subtraction in bash

Let's see it by writing a script that takes two numbers from the user and then prints their sum and subtraction.

#!/bin/bash

read -p "Enter first number: " num1
read -p "Enter second number: " num2

sum=$(($num1+$num2))
sub=$(($num1-$num2))
echo "The summation of $num1 and $num2 is $sum"
echo "The substraction of $num2 from $num1 is $sub"

I believe you are familiar with using the read command to accept user input in bash from the previous chapter.

You should focus on these two lines:

sum=$(($num1+$num2))
sub=$(($num1-$num2))

Save this script as sum.sh and run it. Give it some inputs and check the result.

Bash Basics Series #4: Arithmetic Operations

Multiplication in bash

Let's move to multiplication now.

Here's a sample script that converts kilometers into meters (and troubles US readers :D). For reference, 1 kilometer is equal to 1000 meters.

#!/bin/bash

read -p "Enter distance in kilometers: " km
meters=$(($km*1000))

echo "$km KM equals to $meters meters"

Save the script as multi.sh, give it execute permission and run it. Here's a sample output:

Bash Basics Series #4: Arithmetic Operations

Looks good, no? Let's move on to division.

Division in bash scripts

Let's see division with a very simple script:

#!/bin/bash

num1=50
num2=5

result=$(($num1/$num2))

echo "The result is $result"

You can easily guess the result:

The result is 10

That's fine. But let's change the numbers and try to divide 50 by 6. Here's what it shows as result:

The result is 8

But that's not correct. The correct answer should be 8.33333.

That's because bash only deals with integers by default. You need additional CLI tools to handle floating points (decimals).

The most popular tool is bc which is quite a powerful calculator language to deal with mathematical operations. However, you don't need to go into detail for now.

You have to 'echo' the arithmetic operation to bc via pipe:

echo "$num1/$num2" | bc -l

So, the previous script is modified into:

#!/bin/bash

num1=50
num2=6

result=$(echo "$num1/$num2" | bc -l)

echo "The result is $result"

And now you get the result:

The result is 8.33333333333333333333

Notice the result=$(echo "$num1/$num2" | bc -l), it now uses the command substitution that you saw in chapter 2 of this series.

The -l option loads standard math library. By default, bc will go up to 20 decimal points. You can change the scale to something smaller in this way:

result=$(echo "scale=3; $num1/$num2" | bc -l)

Let's see some more examples of floating points in bash.

Handling floating points in bash scripts

Let's modify the sum.sh script to handle floating points.

#!/bin/bash

read -p "Enter first number: " num1
read -p "Enter second number: " num2

sum=$( echo "$num1+$num2" | bc -l)
sub=$( echo "scale=2; $num1-$num2" | bc -l)
echo "The summation of $num1 and $num2 is $sum"
echo "The substraction of $num2 from $num1 is $sub"

Try running it now and see if handles floating points properly or not:

Bash Basics Series #4: Arithmetic Operations

🏋️🤸 Exercise time

Time to do some maths and bash exercises together.

Exercise 1: Create a script that accepts input in GB and outputs its equivalent value in MB and KB.

Exercise 2: Write a script that takes two arguments and outputs the result in exponential format.

So, if you enter 2 and 3, the output will be 8, which is 2 to the power 3.

Hint: Use the exponentiation operator **

Exercise 3: Write a script that converts Centigrade to Fahrenheit.

Hint: Use the formula F = C x (9/5) + 32. You'll have to use bc command here.

You can discuss the exercises and their solution in the community.

Practice exercise in Bash Basics Series #4: Arithmetic Operations
If you are following the Bash Basics series on It’s FOSS, you can submit and discuss the answers to the exercise at the end of the chapter: Fellow experienced members are encouraged to provide their feedback to new members. Do note that there could be more than one answer to a given problem.
Bash Basics Series #4: Arithmetic Operations

In the next chapter, you'll learn about arrays in Bash. Stay tuned.

Bash Basics Series #5: Using Arrays in Bash
Time to use arrays in bash shell scripts in this chapter. Learn to add elements, delete them and get array length.
Bash Basics Series #4: Arithmetic Operations

]]>
<![CDATA[How to Remove Software Repositories from Ubuntu]]>https://itsfoss.com/remove-software-repositories-ubuntu/64816455c8681879cf737b66Sat, 01 Jul 2023 03:34:15 GMT

You can add external repositories in Ubuntu to access packages unavailable in the official repositories.

For example, if you install Brave browser in Ubuntu, you add its repository to your system. If you add a PPA, that is added as an external repository too.

When you don't need the specific software, you remove it. However, the external repository is still added. You can, and you should also remove it to keep your system pristine.

Ubuntu lets you remove a software repository easily. There are different ways to do that:

  1. Using apt-add-repository command to remove the repository
  2. Using GUI to remove the repository (for desktop users)
  3. By modifying the file contents of the /etc/apt/sources.list file (for experts)

But before that, I highly advise getting familiar with the concept of package managers and repositories if you are new to this concept.

What is a Package Manager in Linux?
Learn about packaging system and package managers in Linux. You’ll learn how do they work and what kind of package managers available.
How to Remove Software Repositories from Ubuntu

Method 1. Remove the repository using apt 🤖

Did you know you can also use the apt command to remove repositories? Well, technically, it's not part of the core apt command but it works in similar fashion.

You can use the add-apt-repository or apt-add-repository commands (both represent the same command) while dealing with external repositories.

First, list the added repositories using the following command:

apt-add-repository --list
How to Remove Software Repositories from Ubuntu

Once done, you can use the apt-add-repository command with the -r flag in shown manner to remove the directory:

sudo apt-add-repository -r repo_name

For example, if I want to remove the yarn repository, I would have to use the following command:

sudo add-apt-repository -r deb https://dl.yarnpkg.com/debian/ stable main
How to Remove Software Repositories from Ubuntu

Press the Enter key for confirmation.

Next, update the repositories using the following:

sudo apt update

And now, if you list enabled repositories, you won't find the removed repository here:

apt-add-repository --list
How to Remove Software Repositories from Ubuntu

There you have it!

Using apt Commands in Linux [Ultimate Guide]
This guide shows you how to use apt commands in Linux with examples so that you can manage packages effectively.
How to Remove Software Repositories from Ubuntu

Method 2. Remove the software repository in Ubuntu using GUI 🖥️

🚧
Removing a repository you know nothing about is not recommended as it may restrict you from installing your favorite package in the future, so make sure you know what you are up to.

Being one of the best distros for beginners, You can use GUI to remove the repository without needing the terminal.

To do so, first, open the software and updates the app from the system menu:

How to Remove Software Repositories from Ubuntu

Now, click on Other Software section, and it will list PPAs and external repositories in your system.

The ones listed as checked ✅ are enabled ones.

To remove a repository, you'd have to follow three simple steps:

  • Select a repository that needs to be removed
  • Click on the remove button
  • And finally, hit the close button
How to Remove Software Repositories from Ubuntu

Once you click on the close button, it will open a prompt asking you to update the information as you make changes.

Simply click on the Reload button:

How to Remove Software Repositories from Ubuntu

Alternatively, you can update the repository from the command line to take effect from the changes:

sudo apt update

Method 3. Remove the repository by removing its directory (for experts 🧑‍💻)

Previously, I explained how you could use tools (GUI and CLI) to remove a repository; here, you will modify the system directory (/etc/apt/sources.list.d) responsible for managing repositories.

So first, change your working directory to sources.list.d and list its contents:

cd /etc/apt/sources.list.d/ && ls
How to Remove Software Repositories from Ubuntu

Here, you will find the list of all the repositories.

If you notice carefully, there will be two files for one repo. Once with the .list extension and one with the .save extension.

You will have to remove the one having the .list extension:

sudo rm Repo_name.list

For example, here, I removed the node repo using the command below:

sudo rm nodesource.list
How to Remove Software Repositories from Ubuntu

To take effect from the changes, update the repository index with:

sudo apt update

Want to know more about the sources.list? Read this article.

What is the Use of sources.list File in Ubuntu Linux?
Understanding the concept of sources.list in Ubuntu will help you understand and fix common update errors in Ubuntu.
How to Remove Software Repositories from Ubuntu

Additional Step: Remove GPG keys after removing the repository (for advanced users)

If you wish to remove the GPG keys after removing the repository, here's how you do it.

First, list the existing GPG keys using the following command:

apt-key list

Now, the output may seem confusing to some users.

Here's what to remember:

  • The GPG key name will be placed above the dashed line (----)
  • The public key is in the second line

For example, here's the relevant data of the Chrome GPG key:

How to Remove Software Repositories from Ubuntu

To remove the GPG key, you can use the last two strings of the public key (without any space).

For example, here's how I will remove the GPG key of the Chrome browser using the last two strings of its public key (D38B 4796):

sudo apt-key del D38B4796
How to Remove Software Repositories from Ubuntu

Similarly, you can also use the entire public key. But this time, you have to include spaces between two strings, as shown:

sudo apt-key del "72EC F46A 56B4 AD39 C907  BBB7 1646 B01B 86E5 0310"

Careful with what you add and what you remove

Especially when you are a new Linux user, you will encounter many exciting things and repositories you will add and remove.

While it is good to experiment, you should always be careful about anything you add/remove to your system. You should keep some things in mind, like: Does it include updated packages? Is it a trusted or maintained repository?

Being cautious will keep your system free from unnecessary repositories and packages.

I hope this guide helps you remove the repository you do not want!

Feel free to let me know if you face any issues in the comments below, and consider joining our It's FOSS Community forum to get faster help!

]]>
<![CDATA[How to Install Wine in Ubuntu]]>https://itsfoss.com/install-wine-ubuntu/63ca906630e79304e922cbf8Fri, 30 Jun 2023 12:40:01 GMT

With some effort, you can run Windows applications on Linux using Wine. Wine is a tool you can try when must use an Windows-only application on Linux.

Please note that you CANNOT run any Windows games or software with Wine. Please go through the database of supported applications. The software rated platinum or gold have a higher chance of running smoothly with Wine.

If you have found a Windows-only software that Wine supports well and now looking to use it, this tutorial will help you with the Wine installation on Ubuntu.

💡
If you have Wine installed before, you should remove it completely to avoid any conflict. Also, you should refer to its download page for additional instructions for specific Linux distributions.

Installing Wine on Ubuntu

There are various ways to install Wine on your system. Almost all the Linux distros come with Wine in their package repository.

Most of the time, the latest stable version of Wine is available via the package repository.

  1. Install WINE from Ubuntu’s repository (easy but may not be the latest version)
  2. Install WINE from Wine’s repository (slightly more complicated but gives the latest version)

Please be patient and follow the steps one by one to install and use Wine. There are several steps involved here.

🚧
Keep in mind that Wine installs too many packages. You will see a massive list of packages and install sizes of around 1.3 GB.
How to Install Wine in Ubuntu
Wine download and installed size

Method 1. Install WINE from Ubuntu (easy)

Wine is available in Ubuntu's Official repositories, where you can easily install it. However, the version available this way may not be the latest.

Even if you are using a 64-bit installation of Ubuntu, you will need to add 32-bit architecture support on your distro, which will benefit you in installing specific software.

Type in the commands below:

sudo dpkg --add-architecture i386

Then install Wine using:

sudo apt update
sudo apt install wine

Method 2: Install the latest version from Wine’s repository

Wine is one such program that receives heavy developments in a short period. So, it is always recommended to install the latest stable version of Wine to get more software support.

First, remove any existing Wine installation.

Step 1: Make sure to add 32-bit architecture support:

sudo dpkg --add-architecture i386

Step 2: Download and add the repository key:

sudo mkdir -pm755 /etc/apt/keyrings
sudo wget -O /etc/apt/keyrings/winehq-archive.key https://dl.winehq.org/wine-builds/winehq.key

Step 3: Now download the WineHQ sources file.

🚧
This step depends on the Ubuntu or Mint version you are using. Please check your Ubuntu version or Mint version. Once you have that information, use the commands for your respective versions.

For Ubuntu 23.04 Lunar Lobster, use the command below:

sudo wget -NP /etc/apt/sources.list.d/ https://dl.winehq.org/wine-builds/ubuntu/dists/lunar/winehq-lunar.sources

If you have Ubuntu 22.04 or Linux Mint 21.X series, use the command below:

sudo wget -NP /etc/apt/sources.list.d/ https://dl.winehq.org/wine-builds/ubuntu/dists/jammy/winehq-jammy.sources

If you are running Ubuntu 20.04 or Linux Mint 20.X series, use:

sudo wget -NP /etc/apt/sources.list.d/ https://dl.winehq.org/wine-builds/ubuntu/dists/focal/winehq-focal.sources

Ubuntu 18.04 or Linux Mint 19.X series users can use the command below to add the sources file:

sudo wget -NP /etc/apt/sources.list.d/ https://dl.winehq.org/wine-builds/ubuntu/dists/bionic/winehq-bionic.sources

Once done, update the package information and install the wine-stable package.

sudo apt install --install-recommends winehq-stable

If you want the development or staging version, use winehq-devel or winehq-staging respectively.

Initial Wine configuration

Once Wine is installed, run the following:

winecfg

This will create the virtual C: Drive for installing Windows applications.

How to Install Wine in Ubuntu
C: Drive in Nautilus File Manager

While following these steps, sometimes, you may not find the “Open With Wine Windows Program Loader” option in Nautilus right-click menu.

In that case, fix it by creating a soft link to appropriate directory:

sudo ln -s /usr/share/doc/wine/examples/wine.desktop /usr/share/applications/

And restart your system to get the change.

Using Wine to run Windows applications

Once you have installed Wine and configured it by running winecfg, now is the time to install Windows apps.

Here, the 7Zip.exe file is used for demonstration purposes. I know I should have used a better example, as 7Zip is available on Linux. Still, the process remains the same for other applications.

Firstly, download the 7Zip .exe file from their official downloads page.

Now, right-click on the file and select "Open With Wine Windows Program Loader" option:

How to Install Wine in Ubuntu
Open EXE file with Wine Program loader

This will prompt us to install the file. Click Install and let it complete. Once done, you can open the 7zip like any other native app.

How to Install Wine in Ubuntu
7Zip in Ubuntu Activities Overview

You can use wine uninstaller command to uninstall any installed application.

Here's a dedicated tutorial on using Wine to run Windows software on Linux:

Run Windows Applications on Linux [Beginners Guide]
Here’s a detailed step-by-step guide with screenshots to show how you can run Windows software on Linux using Wine.
How to Install Wine in Ubuntu

Remove Wine from Ubuntu

If you don't find Wine interesting or if Wine doesn't run the application you want properly, you may need to uninstall Wine. To do this, follow the below steps.

Remove Wine installed through the Ubuntu repository

To remove wine installed through repositories, first run:

sudo apt remove --purge wine

Update your package information:

sudo apt update

Now, use the autoclean command to clear the local repository of retrieved package files that are virtually useless.

sudo apt-get autoclean
sudo apt-get clean

Remove those packages that are installed but no longer required using:

sudo apt autoremove

Now reboot the system.

Remove Wine installed through the Wine repository

Remove the installed wine-stable package.

sudo apt remove --purge wine-stable

Update your package information:

sudo apt update

Now, use the autoclean and clean command to clear the local repository of retrieved package files that are virtually useless.

sudo apt-get autoclean
sudo apt-get clean

Now remove the sources file added earlier. Use your respective distribution folder. Here, Ubuntu 22.04 is used.

sudo rm /etc/apt/sources.list.d/winehq-jammy.sources

Once this is removed, update your system package information:

sudo apt update

Optionally, remove the key file you had added earlier if you want.

sudo rm /etc/apt/keyrings/winehq-archive.key

Now remove any residual files manually.

Still have questions about using Wine?

You may also go through our tutorial on using Wine. It should answer some more questions you might have.

Run Windows Applications on Linux [Beginners Guide]
Here’s a detailed step-by-step guide with screenshots to show how you can run Windows software on Linux using Wine.
How to Install Wine in Ubuntu

There is no place better than the Wine Project website. They have a dedicated FAQ (frequently asked questions) page:

If you still have questions, you can browse through their wiki for detailed documentation or ask your doubts in their forum.

Alternatively, if you don't mind spending some money, you can opt for CrossOver. It's basically Wine but with premium support. You can also contact their team for your questions.

Purchase CrossOver Through the CodeWeavers Store Today!
Buy CrossOver Mac and CrossOver Linux through the CodeWeavers store. Choose from 12 month and lifetime license plans. Renewals are also available for purchase.
How to Install Wine in Ubuntu
Wine with support, your purchase supports wine development (affiliate link)

In my opinion, you should resort to Wine only when you cannot find an alternative to the software you must use. Even in that case, it's not guaranteed to work with Wine.

And yet, Wine provides some hope for Windows migrants to Linux.

]]>
<![CDATA[FOSS Weekly #23.26: Linux Kernel 6.4, Red Hat Lock Down, Exodia OS and More]]>https://itsfoss.com/newsletter/foss-weekly-23-26/649a721695223604faf9a227Thu, 29 Jun 2023 04:27:35 GMT

Red Hat made a decision to restrict access to its source code for paying customers only. This move is likely to 'kill' projects like Rocky Linux and Alma Linux that have filled the void left by CentOS (also killed by Red Hat).

The reason, in my opinion, is that Red Hat doesn't want paying (enterprise) clients to go for its clones like Rocky and Alma Linux. From CentOS discontinuation to this, the move is money-inspired.

💬 Let's see what else you get in this edition of FOSS Weekly:

  • Continuation of our Bash Basics series
  • Exodia OS, an alternative to Kali Linux
  • A new non-LTS Linux Kernel was released recently
  • And other Linux news, videos, and, of course, memes!

📰 Linux news

Linux Kernel 6.4 was recently released as a non-LTS release with many upgrades.

Linux Kernel 6.4 Released: Embracing Apple M2, New Hardware, and More Rust Code
It’s a new Linux Kernel release day! Hardware enthusiast? Dive in to learn more what Linux Kernel 6.4 brings in.
FOSS Weekly #23.26: Linux Kernel 6.4, Red Hat Lock Down, Exodia OS and More

🧠 What we’re thinking about

Software Freedom Conservancy thinks that Red Hat's decision to restrict access to source code for paying customers may have violated GPL.

A Comprehensive Analysis of the GPL Issues With the Red Hat Enterprise Linux (RHEL) Business Model
This article was originally published primarily as a response to IBM’s Red Hat’s change to no longer publish complete, corresponding source (CCS) for RHEL and the prior discontinuation of CentOS Linux (which are related events, as described below). We hope that this will serve as a compre…
FOSS Weekly #23.26: Linux Kernel 6.4, Red Hat Lock Down, Exodia OS and More

🧮 Tutorials

In the third installment of our Bash Basics series, you will learn how to pass arguments to bash scripts and make them interactive.

Bash Basics #3: Pass Arguments and Accept User Inputs
Learn how to pass arguments to bash scripts and make them interactive in this chapter of the Bash Basics series.
FOSS Weekly #23.26: Linux Kernel 6.4, Red Hat Lock Down, Exodia OS and More

The Terminal Tuesday continues with the cat command.

Using cat Command in Linux
Cat command can be used for more than just displaying file contents.
FOSS Weekly #23.26: Linux Kernel 6.4, Red Hat Lock Down, Exodia OS and More

Xfce user? Here are some theme suggestions for you.

11 Themes to Make Xfce Look Modern and Beautiful
Xfce desktop looks outdated? No worries. Here are some of the best themes to make your Xfce desktop look beautiful.
FOSS Weekly #23.26: Linux Kernel 6.4, Red Hat Lock Down, Exodia OS and More

📹 What we are watching

Gedit can be turned into Gedit++ with some simple tips and tweaks.


✨ Project highlights

We recently tested out a Kali Linux alternative that can be used for pen testing purposes.

Exodia OS is a Linux Distro for Cybersecurity Enthusiasts
A new alternative to Kali Linux fans. What do you think?
FOSS Weekly #23.26: Linux Kernel 6.4, Red Hat Lock Down, Exodia OS and More

Reddit's controversial API changes have resulted in the rise of alternative platforms, one such undertaking is Lemmy.

Lemmy: A Decentralized Open-Source Reddit Alternative To Explore
Are you looking for an open-source Reddit alternative? Well, this is something!
FOSS Weekly #23.26: Linux Kernel 6.4, Red Hat Lock Down, Exodia OS and More

🧩 Puzzle (for Pro members only)

Uncover the names of various Linux distributions that offer alternatives to the systemd init system.

Puzzle of The Week: Word Search #3: Systemd-free Linux Distributions
Exercise those ‘little gray cells’ of yours and solve this puzzle.
FOSS Weekly #23.26: Linux Kernel 6.4, Red Hat Lock Down, Exodia OS and More

🛍️ Interesting deal for you

Internxt is offering 2 TB cloud storage for a mere €10.79 a year as part of their summer sale. (WILL BE OVER IN 2 DAYS!)

Internxt Pricing – Get Up To 10GB Free!
Sign up for an Internxt secure cloud storage subscription and get access to our monthly newsletter filled with the latest tech news and updates.
FOSS Weekly #23.26: Linux Kernel 6.4, Red Hat Lock Down, Exodia OS and More

💡 Quick handy tip

You can enable autosave feature in Gedit from Preferences -> Editor. By default, it autosaves every 10 minutes but you can change the duration to your liking.

It won't work with a brand new text file that has never been saved before.

FOSS Weekly #23.26: Linux Kernel 6.4, Red Hat Lock Down, Exodia OS and More

🤣 Meme of the week

Why fight among ourselves when we can unite against close-source operating systems?

FOSS Weekly #23.26: Linux Kernel 6.4, Red Hat Lock Down, Exodia OS and More

🗓️ Tech Trivia

The iconic video game company, Atari, was founded by Nolan Bushnell and Ted Dabney on June 27, 1972. Their first and hugely successful game, Pong, led to the start of the video game industry.

Did you own an Atari?


🧑‍🤝‍🧑 FOSSverse corner

An interesting thread where Community members share why they switched to Linux.

Windows refugees, why have you changed to Linux?
The difference is, in Linux one can fix things. Linux may have more things to fix, but at least you are not powerless.
FOSS Weekly #23.26: Linux Kernel 6.4, Red Hat Lock Down, Exodia OS and More

Come, share your thoughts, too.


❤️ Enjoying FOSS Weekly?

Forward it to Linux-using friends and encourage them to subscribe (hint: it's here).

Become a Pro member and show your support 🙏

Share your views and opinion on 11 years of It's FOSS (I may include it on It's FOSS testimonial pages).

Something else? Share it with me by pressing the reply button.

Don't stop loving It's FOSS :)

]]>
<![CDATA[Using cat Command in Linux]]>https://itsfoss.com/cat-command/649a84ef95223604faf9a2b3Tue, 27 Jun 2023 14:50:20 GMT

The cat command is used to print the file contents of text files.

At least, that's what most Linux users use it for and there is nothing wrong with it.

Cat actually stands for 'concatenate' and was created to merge text files. But withsingle argument, it prints the file contents. And for that reason, it is a go-to choice for users to read files in the terminal without any additional options.

Using the cat command in Linux

To use the cat command, you'd have to follow the given command syntax:

cat [options] Filename(s)

Here,

  • [options] are used to modify the default behavior of the cat command such as using the -n option to get numbers for each line.
  • Filename is where you'll enter the filename of the file that you want to work with.

To make things easy, I will be using a text file named Haruki.txt throughout this guide which contains the following text lines:

Hear the Wind Sing (1979)
Pinball, 1973 (1980)
A Wild Sheep Chase (1982)
Hard-Boiled Wonderland and the End of the World (1985)
Norwegian Wood (1987)
Dance Dance Dance (1990)
South of the Border, West of the Sun (1992)
The Wind-Up Bird Chronicle (1994)
Sputnik Sweetheart (1999)
Kafka on the Shore (2002)
After Dark (2004)
1Q84 (2009-2010)
Colorless Tsukuru Tazaki and His Years of Pilgrimage (2013)
Men Without Women (2014)
Killing Commendatore (2017)

So, what will be the output when used without any options? Well, let's have a look:

cat Haruki.txt
Using cat Command in Linux

As you can see, it printed the whole text file!

But you can do a lot more than just this. Let me show you some practical examples.

1. Create new files

Most Linux users use the touch command to create new files but the same can be done using the cat command too!

The cat command has one advantage over the touch command in this case, as you can add text to the file while creating. Sounds cool. Isn't it?

To do so, you'd have to use the cat command by appending the filename to the > as shown:

cat > Filename

For example, here, I created a file named NewFile.txt:

cat > NewFile.txt

Once you do that, there'll be a blinking cursor asking you to write something and finally, you can use Ctrl + d to save the changes.

If you wish to create an empty file, then just press the Ctrl + d without making any changes.

Using cat Command in Linux

That's it! Now, you can use the ls command to show the contents of the current working directory:

Using cat Command in Linux

2. Copy the file contents to a different file

Think of a scenario where you want to redirect the file content of FileA to the FileB

Sure, you can copy and paste. But what if there are hundreds or thousands of lines?

Simple. You use the cat command with the redirection of data flow. To do so, you'd have to follow the given command syntax:

cat FileA > FileB
🚧

If you use the above syntax to redirect file contents, it will erase the file contents of the FileB and then will redirect the file contents of the FileA.

For example, I will be using two text files FileA and FileB which contains the following:

Using cat Command in Linux

And now, if I use the redirection from FileA to FileB, it will remove the data of FileB and then redirect the data of FileA:

cat FileA > FileB
Using cat Command in Linux

Similarly, you can do the same with multiple files:

cat FileA FileB > FileC
Using cat Command in Linux

As you can see, the above command removed the data of FileC and then redirected the data of FileA and FileB.

Append the content of one file to another

There are times when you want to append data to the existing data and in that case, you'll have to use the >> instead of single >:

cat FileA >> FileB

For example, here, I will be redirecting two files FileA and FileB to the FileC:

cat FileA.txt FileB.txt >> FileC.txt
Using cat Command in Linux

As you can see, it preserved the data of the FileC.txt and the data was appended at the end of it.

💡

You can use the >> to add new lines to an existing file. Use cat >> filename and start adding the text you want and finally save the changes with Ctrl+D.

4. Show the numbers of line

You may encounter such scenarios where you want to see the number of lines, and that can be achieved using the -n option:

cat -n File

For example, here, I used the -n option with the Haruki.txt:

Using cat Command in Linux

5. Remove the blank lines

Left multiple blank lines in your text document? The cat command will fix it for you!

To do so, all you have to do is use the -s flag.

But there's one downside of using the -s flag. You're still left with one blank space:

Using cat Command in Linux

As you can see, it works but the results are close to the expectations.

So how would you remove all the empty lines? By piping it to the grep command:

cat File | grep -v '^$'

Here, the -v flag will filter out the results as per the specified pattern and '^$' is a regular expression that matches the empty lines.

And here are the results when I used it over the Haruki.txt:

cat Haruki.txt | grep -v '^$'
Using cat Command in Linux

Once you have the perfect output, you can redirect it to a file to save the output:

cat Haruki.txt | grep -v '^$' > File
Using cat Command in Linux

That's what you've learned so far

Here's a quick summary of what I explained in this tutorial:

Command Description
cat <Filename> Prints the file content to the terminal.
cat >File Create a new file.
cat FileA > FileB File contents of the FileB will be overridden by the FileA.
cat FileA >> FileB File contents of the FileA will be appended at the end of the FileB.
cat -n File Shows the number of lines while omitting the file contents of the File.
cat File | more Piping the cat command to the more command to deal with large files. Remember, it won't let you scroll up!
cat File | less Piping the cat command to the less command, which is similar to above, but it allows you to scroll both ways.
cat File | grep -v '^$' Removes all the empty lines from the file.

🏋️It's time to exercise

If you learned something new, executing it with different possibilities is the best way to remember.

And for that purpose, here are some simple exercises you can do with the cat command. They will be super basic as cat too is one of the most basic commands.

For practice purposes, you can use our text files from GitHub.

  1. How would you create an empty file using the cat command?
  2. Redirect output produced by the cat command to a new file IF.txt
  3. Can you redirect three or more file inputs to one file? If yes, then how?
]]>
<![CDATA[Bash Basics Series #3: Passing Arguments and Accepting User Inputs]]>https://itsfoss.com/bash-pass-arguments/6499618295223604faf99dbaMon, 26 Jun 2023 13:42:29 GMT

Let's have arguments... with your bash scripts 😉

You can make your bash script more useful and interactive by passing variables to it.

Let me show you this in detail with examples.

Pass arguments to a shell script

When you run a shell script, you can add additional variables to it in the following fashion:

./my_script.sh var1 var2

Inside the script, you can use $1 for the 1st argument, $2 for the 2nd argument and so on.

💡

$0 is a special variable that holds the name of the script being executed.

Let's see it with an actual example. Switch to the directory where you keep your practice bash scripts.

mkdir -p bash_scripts && cd bash_scripts

Now, create a new shell script named arguments.sh (I could not think of any better names) and add the following lines to it:

#!/bin/bash

echo "Script name is: $0"
echo "First argument is: $1"
echo "Second argument is: $2"

Save the file and make it executable. Now run the script like you always do but this time add any two strings to it. You'll see the details printed on the screen.

🚧

Arguments are separated by a white space (space, tab). If you have an argument with space in it, use double quotes around it otherwise it will be counted as separate arguments.

Bash Basics Series #3: Passing Arguments and Accepting User Inputs
💡

Bash scripts support up to 255 arguments. But for arguments 10 and above, you have to use curly braces ${10}, ${11}...${n}.

As you can see, the $0 represents the script name while the rest of the arguments are stored in the numbered variables. There are some other special variables that you may use in your scripts.

Special Variable Description
$0 Script name
$1, $2...$9 Script arguments
${n} Script arguments from 10 to 255
$# Number of arguments
$@ All arguments together
$$ Process id of the current shell
$! Process id of the last executed command
$? Exit status of last executed command
🏋️‍♀️

Modify the above script to display the number of arguments.

What if the number of arguments doesn't match?

In the above example, you provided the bash script with two arguments and used them in the script.

But what if you provided only one argument or three arguments?

Let's do it actually.

Bash Basics Series #3: Passing Arguments and Accepting User Inputs

As you can see above, when you provided more than expected arguments, things were still the same. Additional arguments are not used so they don't create issues.

However, when you provided fewer than expected arguments, the script displayed empty space. This could be problematic if part of your script is dependent on the missing argument.

Accepting user input and making an interactive bash script

You can also create bash scripts that prompt the user to provide input through the keyboard. This makes your scripts interactive.

The read command provides this feature. You can use it like this:

echo "Enter something"
read var

The echo command above is not required but then the end user won't know that they have to provide input. And then everything that the user enters before pressing the return (enter) key is stored in var variable.

You can also display a prompt message and get the value in a single line like this:

read -p "Enter something? " var

Let's see it in action. Create a new interactive.sh shell script with the following content:

#!/bin/bash

echo "What is your name, stranger?"
read name
read -p "What's your full name, $name? " full_name
echo "Welcome, $full_name"

In the above example, I used the name variable to get the name. And then I use the name variable in the prompt and get user input in full_name variable. I used both ways of using the read command.

Now if you give the execute permission and then run this script, you'll notice that the script displays What is your name, stranger? and then waits for you to enter something from the keyboard. You provide input and then it displays What's your full name type of message and waits for the input again.

Here's a sample output for your reference:

Bash Basics Series #3: Passing Arguments and Accepting User Inputs

🏋️ Exercise time

Time to practice what you learned. Try writing simple bash scripts for the following scenarios.

Exercise 1: Write a script that takes three arguments. You have to make the script display the arguments in reverse order.

Expected output:

abhishek@itsfoss:~/bash_scripts$ ./reverse.sh ubuntu fedora arch
Arguments in reverse order:
arch fedora ubuntu

Exercise 2: Write a script that displays the number of arguments passed to it.

Hint: Use special variable $#

Expected output:

abhishek@itsfoss:~/bash_scripts$ ./arguments.sh one and two and three
Total number of arguments: 5

Exercise 3: Write a script that takes a filename as arguments and displays its line number.

Hint: Use wc command for counting the line numbers.

You may discuss your solution in the community.

Practice Exercise in Bash Basics Series #3: Pass Arguments and Accept User Inputs
If you are following the Bash Basics series on It’s FOSS, you can submit and discuss the answers to the exercise at the end of the chapter: Fellow experienced members are encouraged to provide their feedback to new members. Do note that there could be more than one answer to a given problem.
Bash Basics Series #3: Passing Arguments and Accepting User Inputs

Great! So now you can (pass) argument :) In the next chapter, you'll learn to perform basic mathematics in bash.

]]>
<![CDATA[FOSS Weekly #23.25: ONLYOFFICE, Clipboard App, Bash Variables and More Linux Stuff]]>https://itsfoss.com/newsletter/foss-weekly-23-25/6491780095223604faf911ddThu, 22 Jun 2023 04:29:15 GMT

Reintroducing the 'request your tutorial' feature 🦾

You might face some issues in your desktop Linux life. And if you did not find a good tutorial for your problem, feel free to request a tutorial through our Community platform. You can also suggest topics that you think should be covered on It's FOSS.

The 11th-anniversary offer ends this week. Opt for Pro Subscription at 11% discount and get two ebooks: Learn Linux Quickly and Learn Bash Quickly. Pro members can download the books for free from this page.

💬 Let's see what you get in this edition of FOSS Weekly:


📰 Linux news

ONLYOFFICE 7.4 was recently released with drawing support, radar charts, plugins upgrade and more.

Open Source Microsoft Office Alternative ONLYOFFICE Releases Version 7.4
There is a new release of the awesome ONLYOFFICE.
FOSS Weekly #23.25: ONLYOFFICE, Clipboard App, Bash Variables and More Linux Stuff

Similarly, SoftMaker Office 2024 (non-FOSS) recently introduced ChatGPT and DeepL integration.

SoftMaker Office 2024 Releases With Integrated ChatGPT and DeepL
SoftMaker is a well-known office suite for Linux and other platforms. Check out its latest release here.
FOSS Weekly #23.25: ONLYOFFICE, Clipboard App, Bash Variables and More Linux Stuff

🧠 What we’re thinking about

The predictions of Richard Stallman have become a reality, and copyleft is becoming increasingly important.

We need more of Richard Stallman, not less
We need more of Richard Stallman, not less écrit par Ploum, Lionel Dricot, ingénieur, écrivain de science-fiction, développeur de logiciels libres.
FOSS Weekly #23.25: ONLYOFFICE, Clipboard App, Bash Variables and More Linux Stuff

🧮 Tutorials

Continue the journey to the Bash world with the second chapter in the Bash Basics series.

Bash Basics #2: Use Variables in Bash Scripts
In this chapter of the Bash Basics series, learn about using variables in Bash scripts.
FOSS Weekly #23.25: ONLYOFFICE, Clipboard App, Bash Variables and More Linux Stuff

This week's #TerminalTuesday covers the simple but essential cd command.

Using cd Command in Linux
Learn about using one of the basic but essential Linux commands that is used for switching directories.
FOSS Weekly #23.25: ONLYOFFICE, Clipboard App, Bash Variables and More Linux Stuff

Embrace Flatpak on Ubuntu with this new guide.

Install and Use Flatpak on Ubuntu
Ubuntu may come with Snap by default but you could still enjoy the Flatpak universal packages on it.
FOSS Weekly #23.25: ONLYOFFICE, Clipboard App, Bash Variables and More Linux Stuff

📹 What we are watching

NixOS is getting more attention these days.


✨ Application highlights

Here's a clipboard app that offers a lot of functionality.

Meet ‘Clipboard’: An Open-Source App That Aims to Turn Up Your Productivity
The clipboard app is a useful open-source tool with lots of features to improve your productivity.
FOSS Weekly #23.25: ONLYOFFICE, Clipboard App, Bash Variables and More Linux Stuff

Take control of your emails by opting for one of these open-source email servers.

12 Best Open Source Email Servers
Here’s a list of open-source mail servers that you can use to send/receive emails and store mail.
FOSS Weekly #23.25: ONLYOFFICE, Clipboard App, Bash Variables and More Linux Stuff

📥 Don't miss: 11 years of It's FOSS

Test your bash knowledge with this unique collection of bash challenges.

Pro members can get two additional books on Linux commands and Bash on this page. You have to be logged in, of course.

Pro Member Resources
It’s FOSS Pro members have more benefits now 🤩 Here are two premium ebooks that are available for purchase by everyone. Learn Linux Quickly - Linux Commands for BeginnersLearn Linux Quickly doesn’t assume any prior Linux knowledge, which makes it a perfect fit for beginners. Nevertheless, inter…
FOSS Weekly #23.25: ONLYOFFICE, Clipboard App, Bash Variables and More Linux Stuff

🧩 Puzzle (for Pro members only)

Guess the popular Linux applications in the form of scrambled words.

Puzzle of The Week: Word Scramble #2: Guess Popular Linux Apps
Exercise those ‘little gray cells’ of yours and solve this puzzle.
FOSS Weekly #23.25: ONLYOFFICE, Clipboard App, Bash Variables and More Linux Stuff

🛍️ Interesting deals for you

Learn today’s most popular coding languages with this bundle of DRM-free e-books from O’Reilly. Your purchase also supports Code for America.

Humble Tech Book Bundle: Popular Programming Languages 2023 by O’Reilly
We’ve teamed up with O’Reilly for our newest bundle. Get books on Rust, TypeScript, SQL, C, C#, C++, and more programming languages. Pay what you want & support charity!
FOSS Weekly #23.25: ONLYOFFICE, Clipboard App, Bash Variables and More Linux Stuff

Internxt is offering 2 TB cloud storage for a mere €10.79 a year as part of their summer sale.

Internxt Pricing – Get Up To 10GB Free!
Sign up for an Internxt secure cloud storage subscription and get access to our monthly newsletter filled with the latest tech news and updates.
FOSS Weekly #23.25: ONLYOFFICE, Clipboard App, Bash Variables and More Linux Stuff

🤣 Meme of the week

We can only hope for that day to come!

FOSS Weekly #23.25: ONLYOFFICE, Clipboard App, Bash Variables and More Linux Stuff

🗓️ Tech Trivia

On June 18, 1979, Microsoft introduced BASIC for 8086 16-bit microprocessors. This was a stepping stone for Microsoft as it partnered with Seattle Computer Products.

In 1980, IBM wanted to use CP/M operating system for its upcoming PC. The talks failed with CP/M creator Gary Kildall. In 1981, IBM awarded a contract to Microsoft for developing a CP/M like operating system.

Instead of developing it from scratch, Microsoft purchased a CP/M clone, 86-DOS, from Seattle Computer Products and sold it to IBM as PC DOS (later to be known as MS DOS).


🧑‍🤝‍🧑 FOSSverse corner

You can now request a tutorial through our Community platform.

Topic Ideas
<strong>Could not find a tutorial on It’s FOSS? You can request your tutorial or suggest a topic here.</strong>
FOSS Weekly #23.25: ONLYOFFICE, Clipboard App, Bash Variables and More Linux Stuff

And there are no 'small questions' in the Community. You got a question? Ask away.

Ubuntu 23.04 Plethora of updates
For several weeks my two installations of Ubuntu 23.04 have been getting small “Ubuntu Base” or other system updates several times a week, even twice in one day. Is this normal? I’ve started to wonder if these things are legitimate. I know 23.04 is an “interim” version, so maybe it’s normal.
FOSS Weekly #23.25: ONLYOFFICE, Clipboard App, Bash Variables and More Linux Stuff

Come. Join the Community 🫱🫲


❤️ Enjoying FOSS Weekly?

Forward it to Linux-using friends and encourage them to subscribe (hint: it's here).

Become a Pro member and show your support 🙏

Share your views and opinion on 11 years of It's FOSS (I may include it on It's FOSS testimonial pages).

Something else? Share it with me by pressing the reply button.

Don't stop loving It's FOSS :)

]]>
<![CDATA[Install and Use Flatpak on Ubuntu]]>https://itsfoss.com/flatpak-ubuntu/648701188b22977661234adfWed, 21 Jun 2023 07:35:40 GMT

The Linux world has three 'universal' packaging formats that allow running on 'any' Linux distribution; Snap, Flatpak and AppImage.

Ubuntu comes baked-in with Snap but most distributions and developers avoid it because of its close source nature. They prefer Fedora's Flatpak packaging system.

As an Ubuntu user, you are not restricted to Snap. You also can use Flatpak on your Ubuntu system.

In this tutorial, I'll discuss the following:

  • Enabling Flatpak support on Ubuntu
  • Using Flatpak commands to manage packages
  • Getting packages from Flathub
  • Add Flatpak packages to Software Center

Sounds exciting? Let's see them one by one.

Installing Flatpak on Ubuntu

You can easily install Flatpak using the following command:

sudo apt install flatpak

For Ubuntu 18.04 or older versions, use PPA:

sudo add-apt-repository ppa:flatpak/stable
sudo apt update
sudo apt install flatpak

Add Flathub repo

You have installed Flatpak support in your Ubuntu system. However, if you try to install a Flatpak package, you'll get 'No remote refs found' error. That's because there are no Flatpak repositories added and hence Flatpak doesn't even know from where it should get the applications.

Flatpak has a centralized repository called Flathub. A number of Flatpak applications can be found and downloaded from here.

You should add the Flathub repo to access those applications.

flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
Install and Use Flatpak on Ubuntu
Installing Flatpak and add Flathub Repo

Once Flatpak is installed and configured, restart your system. Otherwise, installed Flatpak apps won't be visible on your system menu.

Still, you can always run a flatpak app by running:

flatpak run <package-name>

Common Flatpak Commands

Now that you have Flatpak packaging support installed, it's time to learn some of the most common Flatpak commands needed for package management.

Search for a Package

Either use Flathub website or use the following command, if you know the application name:

flatpak search <package-name>
Install and Use Flatpak on Ubuntu
Search for a Package
🚧

Except for searching a flatpak package, on other instances, the <package-name> refers to the proper Flatpak package name, like com.raggesilver.BlackBox (Application ID in the above screenshot). You may also use the last word Blackbox of the Application ID.

Install a Flatpak package

Here's the syntax for installing a Flatpak package:

flatpak install <remote-repo> <package-name>

Since almost all the times you'll be getting applications from Flathub, the remote repository will be flathub:

flatpak install flathub <package-name>
Install and Use Flatpak on Ubuntu
Install a Package

In some rare cases, you may install Flatpak packages from the developer's repository directly instead of Flathub. In that case, you use a syntax like this:

flatpak install --from https://flathub.org/repo/appstream/com.spotify.Client.flatpakref

Install a package from flatpakref

This is optional and rare too. But sometime, you will get a .flatpakref file for an application. This is NOT an offline installation. The .flatpakref has the necessary details about where to get the packages.

To install from such a file, open a terminal and run:

flatpak install <path-to-flatpakref file>
Install and Use Flatpak on Ubuntu
Install Flatpakref

Run a Flatpak application from the terminal

Again, something you won't be doing it often. Mostly, you'll search for the installing application in the system menu and run the application from there.

However, you can also run them from the terminal using:

flatpak run <package-name>

List installed Flatpak packages

Want to see which Flatpak applications are installed on your system? List them like this:

flatpak list
Install and Use Flatpak on Ubuntu
List Installed Packages

Uninstall a Flatpak package

You can remove an installed Flatpak package in the following manner:

flatpak uninstall <package-name>

If you want to clear the leftover packages and runtimes, that are no longer needed, use:

flatpak uninstall --unused
Install and Use Flatpak on Ubuntu
Remove a package

It may help you save some disk space on Ubuntu.

Flatpak commands summary

Here's a quick summary of the commands you learned above:

Usage Command
Search for Packages flatpak search
Install a Package flatpak install
List Installed Package flatpak list
Install from flatpakref flatpak install <package-name.flatpakref>
Uninstall a Package flatpak uninstall
Uninstall Unused runtimes and packages flatpak uninstall --unused

Using Flathub to explore Flatpak packages

I understand that searching for Flatpak packages through the command line is not the best experience and that's where the Flathub website comes into picture.

You can browse the Flatpak application on Flathub, which provides additional details like verified publishers, total number of downloads etc.

You'll also get the commands you need to use for installing the applications at the bottom of the application page.

Bonus: Use Software Center with Flatpak package support

You can add the Flatpak packages to the GNOME Software Center application and use it for installing packages graphically.

There is a dedicated plugin to add Flatpak to GNOME Software Center.

🚧

Since Ubuntu 20.04, the default software center in Ubuntu is Snap Store and it does not support flatpak integration. So, installing the below package will result in two software centers simultaneously: one Snap and another DEB.

Install and Use Flatpak on Ubuntu
Two Software Center in Ubuntu
sudo apt install gnome-software-plugin-flatpak
Install and Use Flatpak on Ubuntu
Install GNOME Plugin

Conclusion

You learned plenty of things here. You learned to enable Flatpak support in Ubuntu and manage Flatpak packages through the command line. You also learned about the integration with the Software Center.

I hope you feel a bit more comfortable with Flatpaks now. Since you discovered one of the three universal packages, how about learning about Appimages?

How to Use AppImage in Linux [Complete Guide]
What is AppImage? How to run it? How does it work? Here’s the complete guide about using AppImage in Linux.
Install and Use Flatpak on Ubuntu

Let me know if you have questions or if you face any issues.

]]>