Home » Articles by: Brad Morton

Linux clear Command and Clearing Shell/Terminal Screen

Linux clear Command

This article will show you how to use the Linux clear command to clear the terminal screen. Quick and easy! Clearing the Terminal/Shell Screen If you’ve been executing a bunch of commands from your Linux terminal, things can start to look a bit cluttered. It would help if you could clear the screen of previous output and commands and have a fresh start. That’s what the clear command is for. clear Command Syntax Here’s the syntax for the clear command: clear Pretty simple. There are a couple of options to change … Read more

Home » Articles by: Brad Morton

Linux man Command and Man Pages [Explanation/Examples]

Linux man Command

This article describes the purpose and usage of the man command in Linux and other Unix-like operating systems. Linux is a highly modular operating system, consisting of the core operating system (the Linux Kernel) and a collection of software packages that add functionality to it. These packages are generally individually maintained. Thus, each computer system will have different packages depending on what the user requires their system to do (for example, a graphic designer will have some drawing tools installed, whereas someone writing a novel may instead … Read more

Home » Articles by: Brad Morton

How to use the Linux locate Command, With Examples

Linux locate Command

Here’s another tool for your Linux file searching toolbox – the locate command. This explains how to use it. The locate command is specifically made for finding files and folders by their name. It’s easy to use and can search for files using patterns. This is helpful if you are looking for files with a specific type/file extension. Installing locate locate may not be installed by default on your system. To install on Debian/Ubuntu-based distributions, run: sudo apt install mlocate Or on Redhat/CentOS/Fedora: sudo yum install mlocate Linux locate Command Syntax The locate … Read more

Home » Articles by: Brad Morton

How To View and Create Hidden Files in Linux

Linux hidden files

Hidden files are files that are, well, hidden. Here’s how to find and view them on Linux-based Operating Systems. Hidden Files? Hidden files are hidden from view by default unless otherwise specified. Why would you want some files to be hidden? Usually, they are configuration files. You don’t really need to see them during your day-to-day tasks; they’d just clutter things up and get in the way. Your home directory, which includes all of your user files, has several hidden files and folders in it. These include … Read more

Home » Articles by: Brad Morton

Check Type of Variable in JavaScript with typeof [Examples]

JavaScript typeof Operator

This article will explain JavaScript variable types and how to find the type of a variable using the typeof operator. The typeof operator is quite similar to the instanceof operator – but they do not function the same way.  instanceof returns TRUE or FALSE when checking if a variable is of a certain type, whereas typeof returns the name of the type. What are Types? The type of a variable determines what it can or can’t do. It determines what value the variable may take and … Read more

Home » Articles by: Brad Morton

How to Count Files in a Directory in Linux/Ubuntu

Linux Count Files in Directory

This tutorial will show you how to count the number of files/folders in a directory on Linux, both recursively and non-recursively. The wc Command The wc (word count) command counts lines and words. It’s useful here as we’ll use it to count the outputted lines from various tools which list the files in a directory or directories. The below examples will show you how to use the wc command to count files. If you want to know more about it, you can check out the full user manual by running: man … Read more

Home » Articles by: Brad Morton

How to use the JavaScript trim Method, with Examples

JavaScript trim

This easy tutorial will show you how to use the JavaScript string trim() method and give some example usage. The trim()* method is available to any string type variable in JavaScript. It removes any white space (spaces, tabs, newlines) found at the beginning and the end of the string. Why is this useful? Sometimes you wind up with a bunch of un-needed white space padding your strings – often from the end-user hammering the space key when a space isn’t required. Unnecessary white space can also occur after splitting … Read more

Home » Articles by: Brad Morton

How to Get the Last Item in a JavaScript Array [Quick Tip]

JavaScript - Get last item in array

This quick article will show you how to get the last item in an array in the JavaScript programming language. Arrays and Array Indexes in JavaScript Arrays are an ordered list of items. Each item in the array has a numerical index that defines its permission in the array. The first index is index 0 (indexes start counting at 0, not 1!), so the last index is the array’s length; subtract 1. Getting the Last Item in an Array So, to get the last item in an array, we just … Read more

Home » Articles by: Brad Morton

How to Filter Arrays in JavaScript, With Examples

Javascript: filter arrays

We’ve covered arrays in JavaScript pretty extensively on LinuxScrew. This article will show you how to use the filter method – with easy-to-follow examples. JavaScript Arrays Arrays are a type of variable that holds a list of other values or variables. They’re one of the fundamentals of computer programming. These lists contain items at positions (called indexes). These items can be anything – numbers, strings, complex objects – whatever you want to store. Arrays are super useful. You might use them to store the rows in a … Read more

Home » Articles by: Brad Morton

How to Get the Length of an Array in JavaScript [Examples]

JavaScript Array Length

This article will show you how to get the length of an array in JavaScript, as well as provide some code examples. JavaScript is one of the most popular programming languages. From humble origins as a webpage scripting language for animating menus and displaying pop-up ads, it is now a full-blown ecosystem that you can use to build cross-platform mobile apps, web pages, server processes, and even games. JavaScript Arrays Arrays are a vital building block for any program, even simple ones. An array is a … Read more