Index: uspace/app/bdsh/cmds/modules/basename/basename.c
===================================================================
--- uspace/app/bdsh/cmds/modules/basename/basename.c	(revision a91cecd8f04f9a4a33348b55508e32431bc18a09)
+++ uspace/app/bdsh/cmds/modules/basename/basename.c	(revision a91cecd8f04f9a4a33348b55508e32431bc18a09)
@@ -0,0 +1,69 @@
+/* Automatically generated by mknewcmd on Wednesday 28 October 2020 05:35:04 PM
+ * IST This is machine generated output. The author of mknewcmd claims no
+ * copyright over the contents of this file. Where legally permitted, the
+ * contents herein are donated to the public domain.
+ *
+ * You should apply any license and copyright that you wish to this file,
+ * replacing this header in its entirety. */
+
+#include "basename.h"
+#include <mem.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <str.h>
+#include "cmds.h"
+#include "config.h"
+#include "entry.h"
+#include "errors.h"
+#include "util.h"
+
+static const char *cmdname = "basename";
+
+/* Dispays help for basename in various levels */
+void help_cmd_basename(unsigned int level)
+{
+	printf("This is the %s help for '%s'.\n", level ? EXT_HELP : SHORT_HELP,
+	    cmdname);
+	return;
+}
+
+// function for getting file name from the given path.
+static char *filename(char *path)
+{
+	char *base = str_rchr(path, '/');
+	return base ? base + 1 : path;
+}
+
+/* Main entry point for basename, accepts an array of arguments */
+int cmd_basename(char **argv)
+{
+	unsigned int argc;
+
+	/* Count the arguments */
+	for (argc = 0; argv[argc] != NULL; argc++)
+		;
+
+	// atleast 2 arguments must be passed to run the command
+	if (argc < 2) {
+		fprintf(stderr, "%s: expected argument\n", argv[0]);
+		return CMD_FAILURE;
+	}
+
+	// extracting the file name from the given path
+	char *c = filename(argv[1]);
+
+	if (argc > 2) {
+		char *suff = argv[2];
+		char *result =
+		    str_str(c + str_length(c) - str_length(suff), suff);
+		if (result
+		    && (result - c
+		        == (int) (str_length(c) - str_length(suff)))) {
+			*result = '\0';
+		}
+	}
+
+	fprintf(stdout, "%s\n", c);
+
+	return CMD_SUCCESS;
+}
Index: uspace/app/bdsh/cmds/modules/basename/basename.h
===================================================================
--- uspace/app/bdsh/cmds/modules/basename/basename.h	(revision a91cecd8f04f9a4a33348b55508e32431bc18a09)
+++ uspace/app/bdsh/cmds/modules/basename/basename.h	(revision a91cecd8f04f9a4a33348b55508e32431bc18a09)
@@ -0,0 +1,8 @@
+#ifndef BASENAME_H
+#define BASENAME_H
+
+/* Prototypes for the basename command, excluding entry points */
+
+
+#endif /* BASENAME_H */
+
Index: uspace/app/bdsh/cmds/modules/basename/basename_def.inc
===================================================================
--- uspace/app/bdsh/cmds/modules/basename/basename_def.inc	(revision a91cecd8f04f9a4a33348b55508e32431bc18a09)
+++ uspace/app/bdsh/cmds/modules/basename/basename_def.inc	(revision a91cecd8f04f9a4a33348b55508e32431bc18a09)
@@ -0,0 +1,7 @@
+{
+	"basename",
+	"basename strips directory information and suffixes from file names",
+	&cmd_basename,
+	&help_cmd_basename,
+},
+
Index: uspace/app/bdsh/cmds/modules/basename/entry.h
===================================================================
--- uspace/app/bdsh/cmds/modules/basename/entry.h	(revision a91cecd8f04f9a4a33348b55508e32431bc18a09)
+++ uspace/app/bdsh/cmds/modules/basename/entry.h	(revision a91cecd8f04f9a4a33348b55508e32431bc18a09)
@@ -0,0 +1,9 @@
+#ifndef BASENAME_ENTRY_H
+#define BASENAME_ENTRY_H
+
+/* Entry points for the basename command */
+extern int cmd_basename(char **);
+extern void help_cmd_basename(unsigned int);
+
+#endif /* BASENAME_ENTRY_H */
+
Index: uspace/app/bdsh/cmds/modules/modules.c
===================================================================
--- uspace/app/bdsh/cmds/modules/modules.c	(revision 37d4c915fb39ff74e65cfe063a2abfd05093b32d)
+++ uspace/app/bdsh/cmds/modules/modules.c	(revision a91cecd8f04f9a4a33348b55508e32431bc18a09)
@@ -65,4 +65,5 @@
 #include "alias/entry.h"
 #include "unalias/entry.h"
+#include "basename/entry.h"
 
 /*
@@ -92,4 +93,5 @@
 #include "alias/alias_def.inc"
 #include "unalias/unalias_def.inc"
+#include "basename/basename_def.inc"
 
 	{ NULL, NULL, NULL, NULL }
Index: uspace/app/bdsh/meson.build
===================================================================
--- uspace/app/bdsh/meson.build	(revision 37d4c915fb39ff74e65cfe063a2abfd05093b32d)
+++ uspace/app/bdsh/meson.build	(revision a91cecd8f04f9a4a33348b55508e32431bc18a09)
@@ -59,4 +59,5 @@
 	'cmds/modules/unalias/unalias.c',
 	'cmds/modules/unmount/unmount.c',
+	'cmds/modules/basename/basename.c',
 	'compl.c',
 	'errors.c',
